Adding debug log for handling waiting list email and preventing other parallel methods from throwing

This commit is contained in:
Collin Duncan 2023-10-17 10:43:00 +02:00
parent 1abaa934b0
commit 99466bd1f4
No known key found for this signature in database

View file

@ -56,8 +56,10 @@ export class WaitingListService {
if (!this.isRelevantEmail(email)) return if (!this.isRelevantEmail(email)) return
await Promise.all([ await Promise.all([
this.ntfyProvider.sendWaitListEmailReceivedNotification(email.subject), this.ntfyProvider
this.emailProvider.readEmails([email]), .sendWaitListEmailReceivedNotification(email.subject)
.catch(this.loggerService.error),
this.emailProvider.readEmails([email]).catch(this.loggerService.error),
this.handleWaitingListEmail(email), this.handleWaitingListEmail(email),
]) ])
} }
@ -65,6 +67,10 @@ export class WaitingListService {
private async handleWaitingListEmail(email: Email) { private async handleWaitingListEmail(email: Email) {
const { date, startTime } = this.getWaitingListDetails(email) const { date, startTime } = this.getWaitingListDetails(email)
const dateRangeStart = dayjs(`${date} ${startTime}`, 'YYYY-MM-DD HH:mm') const dateRangeStart = dayjs(`${date} ${startTime}`, 'YYYY-MM-DD HH:mm')
this.loggerService.debug('Handling waiting list email', {
date,
startTime,
})
if (!dateRangeStart.isValid()) { if (!dateRangeStart.isValid()) {
this.loggerService.error('Invalid date parsed from email', { this.loggerService.error('Invalid date parsed from email', {
date, date,