Skip to content

Commit

Permalink
Merge pull request #181 from WideChat/run_now_scheduler
Browse files Browse the repository at this point in the history
[NEW] Use run now scheduler method for 0 second payloads
  • Loading branch information
ear-dev authored Apr 7, 2023
2 parents 0c82edf + fbecc12 commit 6c5d54c
Show file tree
Hide file tree
Showing 4 changed files with 553 additions and 471 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"IPostLivechatRoomClosed",
"IUIKitLivechatInteractionHandler"
],
"commitHash": "d036be146784ca79f84f0b2cae50f3cd518cf5a9"
"commitHash": "5e7b3379c606c7166f5567fdcabf857925043529"
}
6 changes: 5 additions & 1 deletion lib/payloadAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export const handlePayloadActions = async (

try {
console.log(`{ roomID: ${rid} } The DF App is scheduling a Job with data ${JSON.stringify(task)}}`);
await modify.getScheduler().scheduleOnce(task);
if (Number(params.time) > 0) {
await modify.getScheduler().scheduleOnce(task);
} else {
await modify.getScheduler().runNow(task);
}
} catch (error) {
console.error(error);
const serviceUnavailable: string = await getLivechatAgentConfig(read, rid, AppSetting.DialogflowServiceUnavailableMessage);
Expand Down
Loading

0 comments on commit 6c5d54c

Please sign in to comment.