mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[clsi] Use clsi-nginx for downloading pandoc exports GitOrigin-RevId: b6013fae6f53c7af714634d700ceed491d724653
24 lines
613 B
JavaScript
24 lines
613 B
JavaScript
import fs from 'node:fs/promises'
|
|
import Path from 'node:path'
|
|
import logger from '@overleaf/logger'
|
|
import Settings from '@overleaf/settings'
|
|
|
|
const TTL_MS = 60 * 1000
|
|
|
|
function scheduleCleanup(conversionId, ttlMs = TTL_MS) {
|
|
const conversionOutputDir = Path.join(Settings.path.outputDir, conversionId)
|
|
setTimeout(() => {
|
|
fs.rm(conversionOutputDir, { recursive: true, force: true }).catch(err => {
|
|
logger.warn(
|
|
{ err, conversionId, conversionOutputDir },
|
|
'failed to clean up conversion output directory'
|
|
)
|
|
})
|
|
}, ttlMs)
|
|
}
|
|
|
|
export default {
|
|
TTL_MS,
|
|
scheduleCleanup,
|
|
}
|