@@ -59,12 +59,12 @@ export class GhostModeReminderCronJob {
5959 async checkGhostModeUsers ( ) : Promise < void > {
6060 this . logger . debug ( `Starting checkGhostModeUsers cron job..` ) ;
6161 const now = new Date ( ) ;
62- const chunks = 100 ;
62+ const chunks = 100 ; // Process users in chunks to prevent memory overload
6363
6464 const intervalHours : IntervalHour [ ] = [
6565 { hours : 24 , translationKey : "main.cron.intervalHours.h24" } ,
6666 { hours : 72 , translationKey : "main.cron.intervalHours.h72" } ,
67- { hours : 336 , translationKey : "main.cron.intervalHours.h336" } ,
67+ { hours : 336 , translationKey : "main.cron.intervalHours.h336" } , // 14 days * 24 hours
6868 ] ;
6969
7070 const notificationTicketsToSend : OfflineryNotification [ ] = [ ] ;
@@ -111,6 +111,7 @@ export class GhostModeReminderCronJob {
111111 await Promise . all (
112112 users . map ( async ( user ) => {
113113 try {
114+ // TODO: Let users configure this in settings
114115 await this . sendEmail ( user , intervalHour ) ;
115116 if ( user . pushToken ) {
116117 const data : NotificationGhostReminderDTO = {
@@ -141,6 +142,10 @@ export class GhostModeReminderCronJob {
141142 to : user . pushToken ,
142143 data,
143144 } ) ;
145+ } else {
146+ this . logger . warn (
147+ `Cannot send push notification for user ${ user . id } to remind about ghost mode since no pushToken. But should have sent email.` ,
148+ ) ;
144149 }
145150
146151 await this . userRepository . update ( user . id , {
@@ -157,6 +162,9 @@ export class GhostModeReminderCronJob {
157162
158163 skip += chunks ;
159164 }
165+ this . logger . debug (
166+ `Ghostmode reminders sent for ${ intervalHour . hours } h.` ,
167+ ) ;
160168 }
161169
162170 const tickets = await this . notificationService . sendPushNotifications (
0 commit comments