Title: SwUpdate checkForUpdate can run multiple times simultaneously · Issue #49618 · angular/angular · GitHub
Open Graph Title: SwUpdate checkForUpdate can run multiple times simultaneously · Issue #49618 · angular/angular
X Title: SwUpdate checkForUpdate can run multiple times simultaneously · Issue #49618 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description If you call SwUpdate.checkForUpdate multiple times from application code, it is not deduplicated. Each call will do the full manif...
Open Graph Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description If you call SwUpdate.checkForUpdate multiple times from application code, it is not dedupl...
X Description: Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description If you call SwUpdate.checkForUpdate multiple times from application code, it is not dedupl...
Opengraph URL: https://github.com/angular/angular/issues/49618
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SwUpdate checkForUpdate can run multiple times simultaneously","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nservice-worker\n\n### Is this a regression?\n\nNo\n\n### Description\n\nIf you call `SwUpdate.checkForUpdate` multiple times from application code, it is not deduplicated. Each call will do the full manifest fetch, and will attempt to install a new version if applicable, downloading all the assets multiple times. The assets themselves should mostly be cached by the browser, so there aren't excessive actual requests, but it does potentially slow down the SW thread with what should be completely unnecessary processing.\r\n\r\n\u003cimg width=\"1512\" alt=\"image\" src=\"https://user-images.githubusercontent.com/8922125/228405071-96f5f7ee-35e4-4c37-98b8-9478e4467c1c.png\">\r\n\r\nThis is relevant for our application, as we run a regular background upgrade check on a timer. If a user has many tabs open, we can end up calling `checkForUpdate` multiple times. Ideally, these multiple calls do not actually trigger multiple downloads and updates.\r\n\r\nnote: the builtin `checkForUpdate` calls are all wrapped in the idle scheduler, so they do not have this issue. or, they kind of do, but it doesn't matter as much because they'll run in sequence and the later calls will just fetch the manifest once and do nothing.\r\n\r\nIf this functionality isn't desired, I should be able to make a PR to fix it.\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\n_ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n \r\nAngular CLI: 14.2.10\r\nNode: 16.14.2\r\nPackage Manager: yarn 1.22.15 \r\nOS: darwin arm64\r\n\r\nAngular: 14.2.12\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... language-service, localize, platform-browser\r\n... platform-browser-dynamic, platform-server, router\r\n... service-worker\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1402.10\r\n@angular-devkit/build-angular 14.2.10\r\n@angular-devkit/core 14.2.10\r\n@angular-devkit/schematics 14.2.10\r\n@angular/cdk 14.2.5\r\n@angular/cli 14.2.10\r\n@angular/fire 7.4.1\r\n@angular/material 14.2.5\r\n@nguniversal/builders 14.2.3\r\n@nguniversal/express-engine 14.0.3\r\n@schematics/angular 14.2.10\r\nrxjs 7.5.7\r\ntypescript 4.8.4\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/henry-alakazhang","@type":"Person","name":"henry-alakazhang"},"datePublished":"2023-03-29T02:01:13Z","url":"https://github.com/angular/angular/issues/49618"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c39c097f-e4b5-cf1e-670f-9a3a300a8484 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB38:E3C4F:DB930C:1189562:6B010802 |
| html-safe-nonce | ddef8dfec6adc87134815b07ecd1eae204e258145e17b0cae90e4b6bf516e28f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjM4OkUzQzRGOkRCOTMwQzoxMTg5NTYyOjZCMDEwODAyIiwidmlzaXRvcl9pZCI6IjY4NDM4MzMyNjUxMjk0MTA1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1f55770c5874793c1939b89de24a5d75f5afd20814f9a8c0bcbc501e07c6b581 |
| hovercard-subject-tag | issue:1644911229 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/49618/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7dbc55a6e5219020be9ff60c5cc7eb4283925cc9ef75c976904ad5ca5dc6fcb6/angular/angular/issues/49618 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7dbc55a6e5219020be9ff60c5cc7eb4283925cc9ef75c976904ad5ca5dc6fcb6/angular/angular/issues/49618 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? service-worker Is this a regression? No Description If you call SwUpdate.checkForUpdate multiple times from application code, it is not dedupl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | henry-alakazhang |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width