diff -up comm-beta/calendar/base/src/calAlarmService.js.alarm comm-beta/calendar/base/src/calAlarmService.js
--- comm-beta/calendar/base/src/calAlarmService.js.alarm 2013-09-10 22:58:42.000000000 +0200
+++ comm-beta/calendar/base/src/calAlarmService.js 2013-09-20 09:13:58.753463348 +0200
@@ -64,6 +64,38 @@ function calAlarmService() {
}
};
+ this.mSleepMonitor = {
+ service: this,
+ interval: 60000,
+ timer: null,
+ expected: null,
+
+ checkExpected: function sm_checkExpected() {
+ let now = Date.now();
+ if (now - this.expected > 1000) {
+ cal.LOG("[calAlarmService] Sleep cycle detected, reloading alarms");
+ this.service.shutdown();
+ this.service.startup();
+ } else {
+ this.expected = now + this.interval;
+ }
+ },
+
+ start: function sm_start() {
+ this.stop();
+ this.expected = Date.now() + this.interval;
+ this.timer = newTimerWithCallback(this.checkExpected.bind(this),
+ this.interval, true);
+ },
+
+ stop: function sm_stop() {
+ if (this.timer) {
+ this.timer.cancel();
+ this.timer = null;
+ }
+ }
+ };
+
this.calendarObserver = {
alarmService: this,
@@ -298,6 +330,8 @@ calAlarmService.prototype = {
this.mSleepMonitor.start();
}
+ this.mSleepMonitor.start();
+
this.mStarted = true;
},
@@ -332,6 +366,8 @@ calAlarmService.prototype = {
this.mSleepMonitor.stop();
+ this.mSleepMonitor.stop();
+
this.mStarted = false;
},