diff --git a/baRSS/Feed Import/UpdateScheduler.m b/baRSS/Feed Import/UpdateScheduler.m index b6a1102..775f88b 100644 --- a/baRSS/Feed Import/UpdateScheduler.m +++ b/baRSS/Feed Import/UpdateScheduler.m @@ -110,6 +110,8 @@ static _Atomic(NSUInteger) _queueSize = 0; dispatch_once(&onceToken, ^{ _timer = [NSTimer timerWithTimeInterval:NSTimeIntervalSince1970 target:[self class] selector:@selector(updateTimerCallback) userInfo:nil repeats:YES]; [[NSRunLoop mainRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes]; + // technically not the right place to register. But since it is run once, its easier than somewhere else. + [NSWorkspace.sharedWorkspace.notificationCenter addObserver:[self class] selector:@selector(didWakeAfterSleep) name:NSWorkspaceDidWakeNotification object:nil]; }); if (!nextTime) nextTime = [NSDate distantFuture]; @@ -123,6 +125,13 @@ static _Atomic(NSUInteger) _queueSize = 0; #endif } ++ (void)didWakeAfterSleep { +#ifdef DEBUG + NSLog(@"did wake from sleep"); +#endif + [UpdateScheduler scheduleNextFeed]; +} + /// Called when schedule timer runs out (earliest @c .schedule date). Or if forced by user. + (void)updateTimerCallback { #ifdef DEBUG