mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-04 14:57:42 +00:00
fix(import): mark the archive as claimed when its job starts
sweepStaleTempUploads deletes temp uploads by mtime alone and its age cutoff matches the job TTL, so a job confirmed just short of a day after upload could have its archive removed mid-run. Touching the file when the run claims it restarts the clock the sweep reads.
This commit is contained in:
parent
959b356a1c
commit
a16a4a57d9
1 changed files with 9 additions and 0 deletions
|
|
@ -378,6 +378,15 @@ function resolveJobTarget(job) {
|
|||
*/
|
||||
async function runImportJob(req, job) {
|
||||
try {
|
||||
/**
|
||||
* `sweepStaleTempUploads` deletes temp uploads by mtime alone, and the job
|
||||
* TTL matches its age cutoff — so a job confirmed just short of a day after
|
||||
* its upload would have its archive removed out from under the run. Marking
|
||||
* the file as touched when the run claims it restarts that clock, which is
|
||||
* the only signal the sweep can see.
|
||||
*/
|
||||
await fs.promises.utimes(job.filepath, new Date(), new Date()).catch(() => undefined);
|
||||
|
||||
const appConfig = req.config;
|
||||
const source = getFileStrategy(appConfig, { isImage: true });
|
||||
const { saveBuffer } = getStrategyFunctions(source);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue