File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -27,14 +27,21 @@ const updateBadge = (count) => {
2727
2828const getNotifications = async ( alarm ) => {
2929 if ( navigator . onLine ) {
30- const handler = manager . getClientById ( alarm . name ) ,
31- update = await handler . check ( ) ;
32- if ( update ) {
33- updateBadge ( await manager . getCount ( ) ) ;
30+ try {
31+ const handler = manager . getClientById ( alarm . name ) ,
32+ update = await handler . check ( ) ;
33+ if ( update ) {
34+ updateBadge ( await manager . getCount ( ) ) ;
35+ }
36+ }
37+ catch ( e ) {
38+ console . error ( e ) ;
39+ }
40+ finally {
41+ browser . alarms . create ( handler . STORE_PREFIX , {
42+ when : handler . getNextCheckTime ( )
43+ } ) ;
3444 }
35- browser . alarms . create ( handler . STORE_PREFIX , {
36- when : handler . getNextCheckTime ( )
37- } ) ;
3845 }
3946 else {
4047 window . addEventListener ( 'online' , ( ) => getNotifications ( alarm ) , {
Original file line number Diff line number Diff line change @@ -257,7 +257,8 @@ class GitHub {
257257 ratelimitRemaining = Math . max ( AVOID_INFINITY , parseInt ( response . headers . get ( "X-RateLimit-Remaining" ) , 10 ) ) ;
258258 this . pollInterval = Math . max (
259259 pollInterval ,
260- Math . ceil ( ( ratelimitReset - nowS ) / ratelimitRemaining )
260+ Math . ceil ( ( ratelimitReset - nowS ) / ratelimitRemaining ) ,
261+ MIN_POLL_INTEVAL
261262 ) ;
262263
263264 const now = new Date ( ) ;
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ class ClientHandler extends window.Storage {
7676 super ( uri . hostname + client . id , area ) ;
7777 this . _prefix = uri . hostname ;
7878 this . client = client ;
79+ this . pollInterval = 60 ;
7980 }
8081
8182 get STORE_PREFIX ( ) {
You can’t perform that action at this time.
0 commit comments