Open 781flyingdutchman opened 3 days ago
Note to self, re Android:
GroupNotification.update
) when a task is enqueued with the WorkManager, not when the task is enqueued with the HoldingQueue. As a result, only WorkManager tasks are included in the numTotal
count, which undercounts the total enqueued for the group. Not sure I fully understand why the number eventually doesn't go beyond the maxConcurrent
value though - likely because the groupNotification object gets destroyed when numFinished == numTotal
but I would have expected new tasks to get added to drive numTotal
up.hasFinished
method which currently returns true if all tasks are not running
. I think it needs to include a check on enqueued
to avoid marking the group as finished prematurely.updateNotification
method of the NotificationServiceupdateNotification
requires a TaskWorker
, which is why we need to use the UpdateNotificationTaskWorker
to update the notification. Current implementation is built to update a notification when the task is not in the WorkManager (e.g. after fail with no retries left) and does not consider groupNotifications (this itself may be a bug) so we need to add thatenqueue
updates are scheduled, we can reasonably prevent this by only recording the enqueue
status if the task was not already present in the list/set of tasks related to the groupNotification, and ignoring it otherwise. We may have to make sure the GroupNotification object isn't destroyed immediately upon completion of the last task, in case the out of order enqueue update arrives after that (which would cause it to re-create the groupNotification object and create a new notification).canceled
notification similar to how we schedule a enqueued
notification, to make sure the numFinished
count of the groupNotification remains in syncHaven't checked iOS but suspect similar issue
Discussed in https://github.com/781flyingdutchman/background_downloader/discussions/418