fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.
859 stars 275 forks source link

[question]: callDispatcher sequence or concurrent? #456

Open feduke-nukem opened 1 year ago

feduke-nukem commented 1 year ago

I have two registered tasks. Frequency of the first is 15 mins and the second's - 1 hour. Both of them are manipulating the same shared preferences key (read/write), so here is the chance that both of them will rise up at the same time (15 mins * 4 = 1 hour).

The question is: does callbackDispatcher method handle provided Futures sequentially or concurrently? Is there any risk of collision of (read/write) operations? The 1 hour task is task of primary priority (over 15 mins task). My goal is to be sure that 15 mins task will write/read by its timing, but the 1 hour task won't be overwritten by the 4th 15 mins task if they start at the same time (idk) or to avoid this behavior at all (by sequence of tasks).

Could anyone help me with this?