File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,12 @@ export async function updateMonitorStatus(monitorId: string): Promise<void> {
247247 const uptime365dData = await uptime365d . json < UptimeRecord > ( ) ;
248248
249249 if ( ! latestData . length ) {
250+ Logger . debug ( "No pulse data found for monitor" , {
251+ monitorId,
252+ monitorName : monitor . name ,
253+ } ) ;
254+
255+ /*
250256 const statusData: StatusData = {
251257 id: monitorId,
252258 type: "monitor",
@@ -262,6 +268,7 @@ export async function updateMonitorStatus(monitorId: string): Promise<void> {
262268 uptime365d: 0,
263269 };
264270 cache.setStatus(monitorId, statusData);
271+ */
265272 return ;
266273 }
267274
Original file line number Diff line number Diff line change @@ -84,11 +84,33 @@ export class MissingPulseDetector {
8484 private async checkMonitor ( monitor : Monitor , now : number ) : Promise < void > {
8585 try {
8686 const status = cache . getStatus ( monitor . id ) ;
87+
88+ // No status data yet - monitor hasn't sent its first pulse
89+ if ( ! status ) {
90+ // Check if enough time has passed since startup to consider this a problem
91+ const timeSinceStartup = now - this . startupTime ;
92+ const expectedInterval = monitor . interval * 1000 ;
93+ const maxAllowedInterval = expectedInterval * monitor . toleranceFactor ;
94+
95+ // Only start checking after grace period + one full interval
96+ if ( timeSinceStartup > this . gracePeriod + maxAllowedInterval ) {
97+ Logger . warn ( "Monitor has never sent a pulse" , {
98+ monitorId : monitor . id ,
99+ monitorName : monitor . name ,
100+ timeSinceStartup : Math . round ( timeSinceStartup / 1000 ) + "s" ,
101+ gracePeriod : this . gracePeriod / 1000 + "s" ,
102+ } ) ;
103+
104+ await this . handleMissingPulse ( monitor , timeSinceStartup , expectedInterval ) ;
105+ }
106+ return ;
107+ }
108+
87109 const lastCheck = status ?. lastCheck ?. getTime ( ) ;
88110
89111 if ( ! lastCheck ) {
90112 // No data yet, skip
91- Logger . debug ( "No status data for monitor" , { monitorId : monitor . id } ) ;
113+ Logger . debug ( "No last check time for monitor" , { monitorId : monitor . id } ) ;
92114 return ;
93115 }
94116
You can’t perform that action at this time.
0 commit comments