Skip to content

Commit e2cec7b

Browse files
committed
More aggressive rageshake log culling
Also bump the client-side timeout on the upload from 3 mins to 5 mins, to see if it helps people on slower connections.
1 parent 6690df1 commit e2cec7b

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎src/vector/rageshake.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,20 @@ class IndexedDBLogStore {
314314
let size = 0;
315315
for (let i = 0; i < allLogIds.length; i++) {
316316
let lines = await fetchLogs(allLogIds[i]);
317-
logs.push({
318-
lines: lines,
319-
id: allLogIds[i],
320-
});
321-
size += lines.length;
322-
if (size > MAX_LOG_SIZE) {
317+
if (i > 0 && size + lines.length > MAX_LOG_SIZE) {
323318
// the remaining log IDs should be removed. If we go out of
324319
// bounds this is just []
320+
//
321+
// XXX: there's nothing stopping the current session exceeding
322+
// MAX_LOG_SIZE. We ought to think about culling it.
325323
removeLogIds = allLogIds.slice(i + 1);
326324
break;
327325
}
326+
logs.push({
327+
lines: lines,
328+
id: allLogIds[i],
329+
});
330+
size += lines.length;
328331
}
329332
if (removeLogIds.length > 0) {
330333
console.log("Removing logs: ", removeLogIds);
@@ -485,6 +488,7 @@ module.exports = {
485488
user_agent: userAgent,
486489
},
487490
json: true,
491+
timeout: 5 * 60 * 1000,
488492
}, (err, res) => {
489493
if (err) {
490494
reject(err);

0 commit comments

Comments
 (0)