WICG / background-sync

A design and spec for ServiceWorker-based background synchronization
https://wicg.github.io/background-sync/spec/
Apache License 2.0
640 stars 85 forks source link

SyncManager.register / SyncManager.getTags never resolves #153

Closed SachsKaylee closed 4 years ago

SachsKaylee commented 4 years ago

Hello there,

I'm having some issues on getting background sync to work reliably - it gives of a really fragile vibe at the moment:

More often than not the SyncManager.register Promise never resolves. I've tried switching networks while it is running, turning WiFi on and off or simply waiting half an hour - nothing. Are there any reasons under which it would lock itself in an infinite loop/etc? - Tested under Chrome 75.0.3770.101 on Android 7.0 while connected to the debugger as a remote device

const tag = "api-sync:status";
console.log("will sync:", tag);
await sw.sync.register(tag);
console.log("sync is ok:", tag); // Never logged

So far I haven't had any luck getting it to work on a desktop OS at all, but that is most likely another issue, and far less pressing.

If required I can try to create a stripped down example repo, but I'd prefer not to since the project is proprietary.

Thanks for your time.

wanderview commented 4 years ago

Its possible you are seeing crbug.com/971505 which is fixed in chrome 77.

Edit: Sorry, thats an internal bug. You can see the related commit here:

https://chromiumdash.appspot.com/commit/6424c3b9454bb44541c5778d75f06ff7c4796d31

SachsKaylee commented 4 years ago

Thank you very much. It seems to work in Chrome Dev (which is 77.0.3865.11).

What is the current recommendation on background sync regarding user facing applications? I don't mind it being Chrome exclusive for the time being given Chromes massive market share, but I do mind inconsistent behavior.

wanderview commented 4 years ago

I'm sorry, but I don't understand the question. It seems you were hitting a chrome bug, so you will need to wait for chrome 77 to be released in early September.

As far as I can tell there isn't a bug in the spec or other browsers. (Although I believe edge is the only other browser to implement background sync.)

SachsKaylee commented 4 years ago

Got it - Thanks for your quick help, you have been a massive time saver.