File tree Expand file tree Collapse file tree
src/app/service/service_worker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,10 +95,14 @@ export default class ServiceWorkerManager {
9595 break ;
9696 }
9797 } ) ;
98- // 8小时检查一次扩展更新
99- chrome . alarms . create ( "checkUpdate" , {
100- delayInMinutes : 0 ,
101- periodInMinutes : 8 * 60 ,
98+ // 12小时检查一次扩展更新
99+ chrome . alarms . get ( "checkUpdate" , ( alarm ) => {
100+ if ( ! alarm ) {
101+ chrome . alarms . create ( "checkUpdate" , {
102+ delayInMinutes : 0 ,
103+ periodInMinutes : 12 * 60 ,
104+ } ) ;
105+ }
102106 } ) ;
103107
104108 // 监听配置变化
Original file line number Diff line number Diff line change @@ -604,8 +604,12 @@ export class SynchronizeService {
604604 this . buildFileSystem ( value ) . then ( async ( fs ) => {
605605 await this . syncOnce ( value , fs ) ;
606606 // 开启定时器, 一小时一次
607- chrome . alarms . create ( "cloudSync" , {
608- periodInMinutes : 60 ,
607+ chrome . alarms . get ( "cloudSync" , ( alarm ) => {
608+ if ( ! alarm ) {
609+ chrome . alarms . create ( "cloudSync" , {
610+ periodInMinutes : 60 ,
611+ } ) ;
612+ }
609613 } ) ;
610614 } ) ;
611615 } else {
You can’t perform that action at this time.
0 commit comments