saved state tweaks: (#809)

- if saved state filename is somehow duplicated, don't readd to array to
avoid deletion (fixes edge case in #791)
- also avoid double interpolation of filename
This commit is contained in:
Ilya Kreymer 2025-04-01 18:59:04 -07:00 committed by GitHub
parent 41b968baac
commit fd41b32100
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2766,7 +2766,9 @@ self.__bx_behaviors.selectMainBehavior();
return;
}
this.saveStateFiles.push(filename);
if (!this.saveStateFiles.includes(filename)) {
this.saveStateFiles.push(filename);
}
if (this.saveStateFiles.length > this.params.saveStateHistory) {
const oldFilename = this.saveStateFiles.shift();
@ -2779,9 +2781,7 @@ self.__bx_behaviors.selectMainBehavior();
}
if (this.storage && done && this.params.saveState === "always") {
const targetFilename = interpolateFilename(filenameOnly, this.crawlId);
await this.storage.uploadFile(filename, targetFilename);
await this.storage.uploadFile(filename, filenameOnly);
}
}