Skip to content

Commit 7a27e8d

Browse files
committed
improve scheduled notifications robustness
1 parent efe574e commit 7a27e8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/NotificationsSchedulerService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async function sendCandidatesAvailableNotifications () {
192192
*/
193193
async function sendInterviewComingUpNotifications () {
194194
localLogger.debug('[sendInterviewComingUpNotifications]: Looking for due records...')
195-
const currentTime = moment.utc()
195+
const currentTime = moment.utc().startOf('minute')
196196
const timestampFilter = {
197197
[Op.or]: []
198198
}
@@ -204,10 +204,10 @@ async function sendInterviewComingUpNotifications () {
204204
timestampFilter[Op.or].push({
205205
[Op.and]: [
206206
{
207-
[Op.gt]: rangeStart
207+
[Op.gte]: rangeStart
208208
},
209209
{
210-
[Op.lte]: rangeEnd
210+
[Op.lt]: rangeEnd
211211
}
212212
]
213213
})
@@ -290,7 +290,7 @@ async function sendInterviewComingUpNotifications () {
290290
async function sendInterviewCompletedNotifications () {
291291
localLogger.debug('[sendInterviewCompletedNotifications]: Looking for due records...')
292292
const window = moment.duration(config.INTERVIEW_COMPLETED_MATCH_WINDOW)
293-
const rangeStart = moment.utc().subtract(moment.duration(config.INTERVIEW_COMPLETED_PAST_TIME))
293+
const rangeStart = moment.utc().startOf('minute').subtract(moment.duration(config.INTERVIEW_COMPLETED_PAST_TIME))
294294
const rangeEnd = rangeStart.clone().add(window)
295295
const filter = {
296296
[Op.and]: [

0 commit comments

Comments
 (0)