[history-v1] increase timeout for downloading the latest content as zip (#34045)

Remove the default timeout as it's too low and a big footgun.

GitOrigin-RevId: 42e26a2a288ad3e38252bc98b909a4bc8b10f70c
This commit is contained in:
Jakob Ackermann
2026-05-27 15:09:17 +02:00
committed by Copybot
parent 4f192564f2
commit d610f404e7
3 changed files with 9 additions and 9 deletions
@@ -290,7 +290,8 @@ async function getZip(req, res, next) {
async function streamZip(snapshot, blobStore, res) {
await withTmpDir('get-zip-', async tmpDir => {
const tmpFilename = Path.join(tmpDir, 'project.zip')
const archive = new ProjectArchive(snapshot)
const zipTimeoutMs = parseInt(config.get('zipStore.zipTimeoutMs'), 10)
const archive = new ProjectArchive(snapshot, zipTimeoutMs)
await archive.writeZip(blobStore, tmpFilename)
res.set('Content-Type', 'application/octet-stream')
res.set('Content-Disposition', 'attachment; filename=project.zip')
@@ -21,7 +21,6 @@ const assert = require('./assert')
// The maximum safe concurrency appears to be 1.
// https://github.com/overleaf/issues/issues/1909
const FETCH_CONCURRENCY = 1 // number of files to fetch at once
const DEFAULT_ZIP_TIMEOUT = 25000 // ms
class DownloadError extends OError {
constructor(hash) {
@@ -49,14 +48,14 @@ class ProjectArchive {
/**
* @constructor
* @param {Snapshot} snapshot
* @param {number} [timeout] in ms
* @param {number} timeout in ms
* @classdesc
* Writes the project snapshot to a zip file.
*/
constructor(snapshot, timeout) {
assert.instance(snapshot, Snapshot)
this.snapshot = snapshot
this.timeout = timeout || DEFAULT_ZIP_TIMEOUT
this.timeout = timeout
}
/**
@@ -62,7 +62,7 @@ describe('ProjectArchive', function () {
it('archives a small snapshot with binary and text data', function () {
return makeMixedTestSnapshot(1)
.then(snapshot => {
const projectArchive = new ProjectArchive(snapshot)
const projectArchive = new ProjectArchive(snapshot, 25_000)
return projectArchive.writeZip(blobStore, zipFilePath)
})
.then(() => {
@@ -83,7 +83,7 @@ describe('ProjectArchive', function () {
it('archives a larger snapshot with binary and text data', function () {
return makeMixedTestSnapshot(10)
.then(snapshot => {
const projectArchive = new ProjectArchive(snapshot)
const projectArchive = new ProjectArchive(snapshot, 25_000)
return projectArchive.writeZip(blobStore, zipFilePath)
})
.then(() => {
@@ -102,7 +102,7 @@ describe('ProjectArchive', function () {
return blobStore
.putString('')
.then(() => {
const projectArchive = new ProjectArchive(snapshot)
const projectArchive = new ProjectArchive(snapshot, 25_000)
return projectArchive.writeZip(blobStore, zipFilePath)
})
.then(() => {
@@ -134,7 +134,7 @@ describe('ProjectArchive', function () {
it('rejects with the error', function () {
return makeMixedTestSnapshot(1)
.then(snapshot => {
const projectArchive = new ProjectArchive(snapshot)
const projectArchive = new ProjectArchive(snapshot, 25_000)
return projectArchive.writeZip(blobStore, zipFilePath)
})
.then(() => {
@@ -169,7 +169,7 @@ describe('ProjectArchive', function () {
it('rejects with the error', function () {
return makeMixedTestSnapshot(1)
.then(snapshot => {
const projectArchive = new ProjectArchive(snapshot)
const projectArchive = new ProjectArchive(snapshot, 25_000)
return projectArchive.writeZip(blobStore, zipFilePath)
})
.then(() => {