mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #29700 from overleaf/bg-history-v1-log-stalled-uploads
Add timeout warnings for long-running blob and chunk uploads GitOrigin-RevId: 5a57ebaaea9dfcaf23153f7e6f27190af541eb16
This commit is contained in:
@@ -74,6 +74,12 @@ export async function uploadBlobToBackup(historyId, blob, path, persistor) {
|
||||
let backupSource
|
||||
let contentEncoding
|
||||
let size
|
||||
const timer = setTimeout(function () {
|
||||
logger.warn(
|
||||
{ historyId, blob, path, size },
|
||||
'blob upload still active after 1 minute'
|
||||
)
|
||||
}, 60 * 1000)
|
||||
try {
|
||||
if (blob.getStringLength()) {
|
||||
backupSource = filePathCompressed
|
||||
@@ -109,6 +115,7 @@ export async function uploadBlobToBackup(historyId, blob, path, persistor) {
|
||||
}
|
||||
)
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
if (backupSource === filePathCompressed) {
|
||||
try {
|
||||
await fs.promises.rm(filePathCompressed, { force: true })
|
||||
|
||||
@@ -221,16 +221,26 @@ async function backupChunk(
|
||||
}
|
||||
const key = makeChunkKey(historyId, chunkToBackup.startVersion)
|
||||
logger.debug({ chunkRecord, historyId, projectId, key }, 'backing up chunk')
|
||||
await chunkBackupPersistorForProject.sendStream(
|
||||
chunksBucket,
|
||||
makeChunkKey(historyId, chunkToBackup.startVersion),
|
||||
Stream.Readable.from([chunkBuffer]),
|
||||
{
|
||||
contentType: 'application/json',
|
||||
contentEncoding: 'gzip',
|
||||
contentLength: chunkBuffer.byteLength,
|
||||
}
|
||||
)
|
||||
const timer = setTimeout(function () {
|
||||
logger.warn(
|
||||
{ historyId, chunkRecord, size: chunkBuffer.byteLength },
|
||||
'chunk upload still active after 1 minute'
|
||||
)
|
||||
}, 60 * 1000)
|
||||
try {
|
||||
await chunkBackupPersistorForProject.sendStream(
|
||||
chunksBucket,
|
||||
makeChunkKey(historyId, chunkToBackup.startVersion),
|
||||
Stream.Readable.from([chunkBuffer]),
|
||||
{
|
||||
contentType: 'application/json',
|
||||
contentEncoding: 'gzip',
|
||||
contentLength: chunkBuffer.byteLength,
|
||||
}
|
||||
)
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
}
|
||||
|
||||
async function updateBackupStatus(
|
||||
|
||||
Reference in New Issue
Block a user