Skip to content

improve scheduled notifications robustness #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/services/NotificationsSchedulerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ async function sendCandidatesAvailableNotifications () {
*/
async function sendInterviewComingUpNotifications () {
localLogger.debug('[sendInterviewComingUpNotifications]: Looking for due records...')
const currentTime = moment.utc()
const currentTime = moment.utc().startOf('minute')
const timestampFilter = {
[Op.or]: []
}
Expand All @@ -204,10 +204,10 @@ async function sendInterviewComingUpNotifications () {
timestampFilter[Op.or].push({
[Op.and]: [
{
[Op.gt]: rangeStart
[Op.gte]: rangeStart
},
{
[Op.lte]: rangeEnd
[Op.lt]: rangeEnd
}
]
})
Expand Down Expand Up @@ -290,7 +290,7 @@ async function sendInterviewComingUpNotifications () {
async function sendInterviewCompletedNotifications () {
localLogger.debug('[sendInterviewCompletedNotifications]: Looking for due records...')
const window = moment.duration(config.INTERVIEW_COMPLETED_MATCH_WINDOW)
const rangeStart = moment.utc().subtract(moment.duration(config.INTERVIEW_COMPLETED_PAST_TIME))
const rangeStart = moment.utc().startOf('minute').subtract(moment.duration(config.INTERVIEW_COMPLETED_PAST_TIME))
const rangeEnd = rangeStart.clone().add(window)
const filter = {
[Op.and]: [
Expand Down