Gate settings updates
This commit is contained in:
parent
cb3ffde342
commit
abba023c20
2 changed files with 15 additions and 6 deletions
|
|
@ -23,9 +23,15 @@ export class SyncService {
|
||||||
private readonly settings: Settings,
|
private readonly settings: Settings,
|
||||||
private readonly logger: Logger
|
private readonly logger: Logger
|
||||||
) {
|
) {
|
||||||
this.createClient(settings.getSettings());
|
this.createClient(settings.getSettings().remoteUri);
|
||||||
|
|
||||||
settings.addOnSettingsChangeHandlers(this.createClient.bind(this));
|
settings.addOnSettingsChangeHandlers((newSettings, oldSettings) => {
|
||||||
|
if (newSettings.remoteUri === oldSettings.remoteUri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createClient(newSettings.remoteUri);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static formatError(
|
private static formatError(
|
||||||
|
|
@ -281,14 +287,14 @@ export class SyncService {
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createClient(settings: SyncSettings): void {
|
private createClient(remoteUri: string): void {
|
||||||
this.client = createClient<paths>({
|
this.client = createClient<paths>({
|
||||||
baseUrl: settings.remoteUri,
|
baseUrl: remoteUri,
|
||||||
fetch: retriedFetchFactory(this.logger)
|
fetch: retriedFetchFactory(this.logger)
|
||||||
});
|
});
|
||||||
|
|
||||||
this.clientWithoutRetries = createClient<paths>({
|
this.clientWithoutRetries = createClient<paths>({
|
||||||
baseUrl: settings.remoteUri
|
baseUrl: remoteUri
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,10 @@ export class Syncer {
|
||||||
concurrency: settings.getSettings().syncConcurrency
|
concurrency: settings.getSettings().syncConcurrency
|
||||||
});
|
});
|
||||||
|
|
||||||
settings.addOnSettingsChangeHandlers((newSettings) => {
|
settings.addOnSettingsChangeHandlers((newSettings, oldSettings) => {
|
||||||
|
if (newSettings.syncConcurrency === oldSettings.syncConcurrency) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.syncQueue.concurrency = newSettings.syncConcurrency;
|
this.syncQueue.concurrency = newSettings.syncConcurrency;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue