bitfireAT / davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
https://www.davx5.com
GNU General Public License v3.0
1.27k stars 69 forks source link

SyncWorker not in state ENQUEUED after enqueueAllAuthorities() #406

Closed mbiebl closed 8 months ago

mbiebl commented 8 months ago

If you run SyncWorker.enqueueAllAuthorities(...) with WiFi turned off, I would expect that

val isSyncPending = SyncWorker.exists(getApplication(),
            listOf(WorkInfo.State.ENQUEUED),
            accountModel.account,
            authorities)

would switch from false to true. This is not the case though.

This is surprising, since WorkInfo.State.ENQUEUED says

Used to indicate that the WorkRequest is enqueued and eligible to run when its Constraints are met and resources are available.

Am I missing something obvious here?

sunkup commented 8 months ago

would switch from false to true. This is not the case though.

Only if there is no internet connectivity at all. Maybe you turned wifi off, but left the metered connection on? Also check the newly introduced account setting "VPN connectivity", in case you use a VPN.

It works for me. When I start a sync without internect connection (wifi and metered turned off) isSyncPending turns from false to true.

If you believe there is a bug on your side, can you provide exact steps to reproduce?

mbiebl commented 8 months ago

Hm, now I can't reproduce the problem anymore either. Closing as a fluke. Sorry for the noise.

mbiebl commented 8 months ago

Ah, I guess what happened is that I scheduled multiple sync requests and missed the first one. Subsequent sync requests did not update the isSyncPending state