1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-08-16 07:50:34 +03:00

Merge pull request #9546 from bc547-dev/master

Make autoSync more robust for network errors
This commit is contained in:
Eugene 2024-03-27 09:21:51 +01:00 committed by GitHub
commit 8f68105460
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,13 +184,17 @@ export class ConfigSyncService {
private async autoSync () {
while (true) {
if (this.isEnabled() && this.config.store.configSync.auto) {
const cfg = await this.getConfig(this.config.store.configSync.configID)
if (new Date(cfg.modified_at) > this.lastRemoteChange) {
this.logger.info('Remote config changed, downloading')
this.download()
this.lastRemoteChange = new Date(cfg.modified_at)
try {
if (this.isEnabled() && this.config.store.configSync.auto) {
const cfg = await this.getConfig(this.config.store.configSync.configID)
if (new Date(cfg.modified_at) > this.lastRemoteChange) {
this.logger.info('Remote config changed, downloading')
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))
}