mirror of
https://github.com/Eugeny/tabby
synced 2024-12-13 14:52:45 +00:00
Make autoSync more robust for network errors
Catch uncaught error in autoSync that caused autoSync to stop syncing
This commit is contained in:
parent
24c64a5e24
commit
c906af5bec
1 changed files with 10 additions and 6 deletions
|
@ -184,13 +184,17 @@ export class ConfigSyncService {
|
||||||
|
|
||||||
private async autoSync () {
|
private async autoSync () {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (this.isEnabled() && this.config.store.configSync.auto) {
|
try {
|
||||||
const cfg = await this.getConfig(this.config.store.configSync.configID)
|
if (this.isEnabled() && this.config.store.configSync.auto) {
|
||||||
if (new Date(cfg.modified_at) > this.lastRemoteChange) {
|
const cfg = await this.getConfig(this.config.store.configSync.configID)
|
||||||
this.logger.info('Remote config changed, downloading')
|
if (new Date(cfg.modified_at) > this.lastRemoteChange) {
|
||||||
this.download()
|
this.logger.info('Remote config changed, downloading')
|
||||||
this.lastRemoteChange = new Date(cfg.modified_at)
|
this.download()
|
||||||
|
this.lastRemoteChange = new Date(cfg.modified_at)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.debug("Recovering from autoSync network error")
|
||||||
}
|
}
|
||||||
await new Promise(resolve => setTimeout(resolve, 60000))
|
await new Promise(resolve => setTimeout(resolve, 60000))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue