Reduce Signal message polling frequency from 15s to 30s
This commit is contained in:
parent
e8f2cc4c50
commit
eea56dd50b
1 changed files with 10 additions and 11 deletions
|
|
@ -205,18 +205,17 @@ const fetchSignalMessagesTask = async ({
|
||||||
|
|
||||||
if (scheduleTasks === "true") {
|
if (scheduleTasks === "true") {
|
||||||
// because cron only has minimum 1 minute resolution
|
// because cron only has minimum 1 minute resolution
|
||||||
for (const offset of [15000, 30000, 45000]) {
|
// schedule one additional job at 30s to achieve 30-second polling
|
||||||
await worker.addJob(
|
await worker.addJob(
|
||||||
"fetch-signal-messages",
|
"fetch-signal-messages",
|
||||||
{ scheduleTasks: "false" },
|
{ scheduleTasks: "false" },
|
||||||
{
|
{
|
||||||
maxAttempts: 1,
|
maxAttempts: 1,
|
||||||
runAt: new Date(Date.now() + offset),
|
runAt: new Date(Date.now() + 30000),
|
||||||
jobKey: `fetchSignalMessages-${offset}`,
|
jobKey: "fetchSignalMessages-30000",
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const messagesClient = new MessagesApi(config);
|
const messagesClient = new MessagesApi(config);
|
||||||
const rows = await db.selectFrom("SignalBot").selectAll().execute();
|
const rows = await db.selectFrom("SignalBot").selectAll().execute();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue