Compare commits

...

3 Commits

Author SHA1 Message Date
D. Berge
7b6b81dbc5 Add more debugging statements 2023-10-04 14:50:12 +02:00
D. Berge
2e11c574c2 Throw rather than return.
Otherwise the finally {} block won't run.
2023-10-04 14:49:35 +02:00
D. Berge
d07565807c Do not retry immediately 2023-10-04 14:49:09 +02:00

View File

@@ -35,7 +35,7 @@ class ReportLineChangeTime {
while (this.queue.length > 0) {
if (this.queue[0].isPending) {
DEBUG("Queue busy");
setImmediate(() => this.processQueue());
setTimeout(() => this.processQueue(), 1000); // We're not in a hurry
return;
}
@@ -46,7 +46,7 @@ class ReportLineChangeTime {
const forward = (cur.old?.labels?.includes("LGSP") || cur.new?.labels?.includes("LGSP"));
if (!projectId) {
WARNING("No projectID found in event", cur);
throw {message: "No projectID found in event", cur};
return;
}
@@ -267,6 +267,7 @@ class ReportLineChangeTime {
}
async run (data) {
DEBUG("Seen", data);
if (!data || data.channel !== "event") {
return;
}
@@ -285,10 +286,12 @@ class ReportLineChangeTime {
if (this.queue.length < ReportLineChangeTime.MAX_QUEUE_SIZE) {
this.queue.push({
...data.payload,
const item = {
...structuredClone(data.payload),
isPending: this.queue.length,
});
};
DEBUG("Queueing", item);
this.queue.push(item);
} else {
ALERT("ReportLineChangeTime queue full at", this.queue.length);