Adding a delay to the monitoring during court reservation
This commit is contained in:
parent
bac0e3971d
commit
ca3e374d19
2 changed files with 7 additions and 6 deletions
|
|
@ -4,8 +4,6 @@ import { Cron, CronExpression } from '@nestjs/schedule'
|
||||||
|
|
||||||
import dayjs from '../common/dayjs'
|
import dayjs from '../common/dayjs'
|
||||||
import { LoggerService } from '../logger/service.logger'
|
import { LoggerService } from '../logger/service.logger'
|
||||||
import { MONITORING_QUEUE_NAME, MonitoringQueue } from '../monitoring/config'
|
|
||||||
import { MonitorType } from '../monitoring/entity'
|
|
||||||
import { NtfyProvider } from '../ntfy/provider'
|
import { NtfyProvider } from '../ntfy/provider'
|
||||||
import { BaanReserverenService } from '../runner/baanreserveren/service'
|
import { BaanReserverenService } from '../runner/baanreserveren/service'
|
||||||
import { RESERVATIONS_QUEUE_NAME, ReservationsQueue } from './config'
|
import { RESERVATIONS_QUEUE_NAME, ReservationsQueue } from './config'
|
||||||
|
|
|
||||||
|
|
@ -606,10 +606,13 @@ export class BaanReserverenService {
|
||||||
await this.navigateToDay(date)
|
await this.navigateToDay(date)
|
||||||
}
|
}
|
||||||
const statuses = await this.getAllCourtStatuses()
|
const statuses = await this.getAllCourtStatuses()
|
||||||
await this.monitoringQueue.add({
|
await this.monitoringQueue.add(
|
||||||
|
{
|
||||||
type: MonitorType.CourtReservations,
|
type: MonitorType.CourtReservations,
|
||||||
data: statuses,
|
data: statuses,
|
||||||
})
|
},
|
||||||
|
{ delay: 60 * 1000 },
|
||||||
|
)
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
this.loggerService.error(
|
this.loggerService.error(
|
||||||
`Failed to monitor court reservations: ${(error as Error).message}`,
|
`Failed to monitor court reservations: ${(error as Error).message}`,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue