Closed Bug 1700047 Opened 2 years ago Closed 2 years ago

Calendars should be passed to calIObserver.onStartBatch and onEndBatch

Categories

(Calendar :: Provider: CalDAV, enhancement)

enhancement

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
89 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

Attachments

(2 files)

onStartBatch and onEndBatch exist to give observers the chance to ignore notifications they're not interested in. For example if you know you're going to be reloading soon, you can ignore onAddItem and onModifyItem notifications until then. To give more fine-grained control, we should pass the calendar in question to the batch notifications.

This makes the alarm service ignore onAddItem and onModifyItem notifications in between onStartBatch and onEndBatch.
We know that onLoad will follow, at which point we reload all alarms from the calendar in question.
Ignoring the notifications prevents the alarms from firing multiple times in quick succession as the calendar loads.

I have in mind to follow this pattern across all of the UI pieces that listen to notifications, but first I really want to be sure (with tests) that sane behaviour is occurring.

I've added tests for this and (really lightly) the unifinder with all of the calendar types. More testing will be added to this later.
The ICS calendar with offline storage doesn't quite work right (as is the case in bug 1691885) but we can still test what does work.

Depends on D109273

Attachment #9210667 - Attachment description: Bug 1700047 - Pass a calendar to calIObserver.onStartBatch and onEndBatch. r?Fallen → Bug 1700047 - Pass a calendar to calIObserver.onStartBatch and onEndBatch. r?mkmelin
Attachment #9210668 - Attachment description: Bug 1700047 - Use batch notifications for better handling in CalAlarmService. r?Fallen → Bug 1700047 - Use batch notifications for better handling in CalAlarmService. r?mkmelin

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/e944239ffe2d
Pass a calendar to calIObserver.onStartBatch and onEndBatch. r=mkmelin
https://hg.mozilla.org/comm-central/rev/9a728acf9240
Use batch notifications for better handling in CalAlarmService. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
See Also: → 1708596
You need to log in before you can comment on or make changes to this bug.