Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodic Background Sync not working (official demo) #31

Open
giovanniincammicia opened this issue Nov 4, 2021 · 1 comment
Open

Periodic Background Sync not working (official demo) #31

giovanniincammicia opened this issue Nov 4, 2021 · 1 comment

Comments

@giovanniincammicia
Copy link

Hi, I'm trying to implement periodic background sync on a service worker following the steps in this documentation:
https://web.dev/periodic-background-sync/
I also installed the demo, but so far I haven't seen the periodicsync event fired not even once.

It does work though if I click "sync manually" or if I trigger the tag from devtools. But it doesn't work periodically.
I've read that browsers can decide when to sync, but I'm not able to reproduce the behaviour in any way.
Is there a bug or am I missing something?

A couple of things that could be useful: I checked the status and it's "granted". I checked the active tags and I can see the one I registered.

There are also two questions on StackOverflow (unanswered) about this.
https://stackoverflow.com/questions/66649131/periodic-background-sync-not-working-on-pwa-official-api-demo-broken
https://stackoverflow.com/questions/65096834/periodic-sync-not-fired-in-service-worker

I guess I can't simply call a setInterval inside a service worker because it's going to be shut after a while. For the same reason, I guess that a WebSocket wouldn't work either.

@jeffposnick
Copy link
Contributor

Have you waited between 24-48 hours? For current Chrome implementations, I believe that the periodic background sync is throttled to once per day, but I don't know what time of day that actually happens.

We can follow up with a bug via https://crbug.com/new if it looks like you can't trigger a periodic background sync at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants