Closed Bug 1042125 Opened 10 years ago Closed 10 years ago

Make the CalDAV provider async safe

Categories

(Calendar :: Provider: CalDAV, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: anderson, Assigned: anderson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

Currently CalDAV assumes some storage calendar functions are synchronous, which will no longer be the case.
Attached patch AsyncCalDAV (obsolete) β€” β€” Splinter Review
Attachment #8460305 - Flags: review?(philipp)
Attached patch AsyncCalDAV (obsolete) β€” β€” Splinter Review
Attachment #8460305 - Attachment is obsolete: true
Attachment #8460305 - Flags: review?(philipp)
Attachment #8460307 - Flags: review?(philipp)
Comment on attachment 8460307 [details] [diff] [review]
AsyncCalDAV

Review of attachment 8460307 [details] [diff] [review]:
-----------------------------------------------------------------

Code looks good, r=philipp. I will give this a test run after my rebuild finishes. I'd appreciate if you could upload a new patch with the below comments fixed.

Please pull the latest changes from comm-central, there are some minor conflicts in the first chunk of calDavCalendar.js after bug 1021684.

::: calendar/base/modules/calAsyncUtils.jsm
@@ +3,5 @@
> +     * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +     
> +    Components.utils.import("resource://calendar/modules/calUtils.jsm");
> +    Components.utils.import("resource://gre/modules/Promise.jsm");
> +     

Looks like I left a few redundant whitespaces in this file, could you remove them?

::: calendar/providers/caldav/calDavCalendar.js
@@ +1036,2 @@
>  
> +        Task.spawn(function() {

function*() {

@@ +1103,5 @@
>       * @param path Path of the item to delete, must not be encoded
>       */
>      deleteTargetCalendarItem: function caldav_deleteTargetCalendarItem(path) {
> +        let self = this;
> +        return Task.spawn(function*() {

I just found a pretty cool feature of Task.jsm thats not documented on MDN. Its very useful for functions like this where all that is run is a Task. It also saves us the let self = this crutch.


deleteTargetCalendaItem: Task.async(function*() {
    let pcal = promisifyCalendar(this.mOfflineStorage);
    ....

}),

See here for more details:
http://mxr.mozilla.org/comm-central/source/mozilla/toolkit/modules/Task.jsm#168


On a side note, you should also use this in the async storage patch.
Attachment #8460307 - Flags: review?(philipp) → review+
Comment on attachment 8460307 [details] [diff] [review]
AsyncCalDAV

As discussed via IRC, there are still some issues with the patch. First of all the missing cal.async prefix, then the item is not removed from the calendar. Setting r- to reflect this, looking forward to the new patch.
Attachment #8460307 - Flags: review+ → review-
Attached patch AsyncCalDAV (obsolete) β€” β€” Splinter Review
Attachment #8460307 - Attachment is obsolete: true
Attachment #8460765 - Flags: review?(philipp)
Comment on attachment 8460765 [details] [diff] [review]
AsyncCalDAV

Review of attachment 8460765 [details] [diff] [review]:
-----------------------------------------------------------------

Great, works as expected and code looks good. r=philipp
Attachment #8460765 - Flags: review?(philipp) → review+
Setting checkin-needed as the tree currently has APPROVAL REQUIRED. https://tbpl.mozilla.org/?tree=Thunderbird-Trunk
Keywords: checkin-needed
Target Milestone: --- → 3.6
Attached patch AsyncCalDAV β€” β€” Splinter Review
Ah I found a minor issue with calAsyncUtils.jsm. First of all it was indented by one level, then we forgot to change this.itemStatus when the onGetResult fails. This patch fixes both issues.
Attachment #8460765 - Attachment is obsolete: true
Attachment #8460807 - Flags: review+
https://hg.mozilla.org/comm-central/rev/74269aa54a84
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: