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,17 +205,16 @@ const fetchSignalMessagesTask = async ({
|
|||
|
||||
if (scheduleTasks === "true") {
|
||||
// because cron only has minimum 1 minute resolution
|
||||
for (const offset of [15000, 30000, 45000]) {
|
||||
await worker.addJob(
|
||||
"fetch-signal-messages",
|
||||
{ scheduleTasks: "false" },
|
||||
{
|
||||
maxAttempts: 1,
|
||||
runAt: new Date(Date.now() + offset),
|
||||
jobKey: `fetchSignalMessages-${offset}`,
|
||||
},
|
||||
);
|
||||
}
|
||||
// schedule one additional job at 30s to achieve 30-second polling
|
||||
await worker.addJob(
|
||||
"fetch-signal-messages",
|
||||
{ scheduleTasks: "false" },
|
||||
{
|
||||
maxAttempts: 1,
|
||||
runAt: new Date(Date.now() + 30000),
|
||||
jobKey: "fetchSignalMessages-30000",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const messagesClient = new MessagesApi(config);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue