From 0c3d507455bbf77d956e2f6c303e08ef6d9d8c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 24 Jan 2020 11:46:46 +0100 Subject: [PATCH] EventIndex: Cancel the crawler early after a message request. If we're cancelling the crawler nowadays this means that we're likely deleting the index. Processing these messages is wasted effort in that case so break early. --- src/indexing/EventIndex.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/indexing/EventIndex.js b/src/indexing/EventIndex.js index 85e75cfc82..723d516a29 100644 --- a/src/indexing/EventIndex.js +++ b/src/indexing/EventIndex.js @@ -266,6 +266,11 @@ export default class EventIndex extends EventEmitter { continue; } + if (cancelled) { + this.crawlerCheckpoints.push(checkpoint); + break; + } + if (res.chunk.length === 0) { console.log("EventIndex: Done with the checkpoint", checkpoint); // We got to the start/end of our timeline, lets just