Add 2 more settings from consts
This commit is contained in:
parent
3cdd2a4387
commit
83c15a77c3
5 changed files with 34 additions and 22 deletions
|
|
@ -24,7 +24,7 @@ import type { MaybeOutdatedClientCursors } from "./types/maybe-outdated-client-c
|
|||
import { FileChangeNotifier } from "./sync-operations/file-change-notifier";
|
||||
import { FixedSizeDocumentCache } from "./utils/data-structures/fix-sized-cache";
|
||||
import { setUpTelemetry } from "./utils/set-up-telemetry";
|
||||
import { DIFF_CACHE_SIZE_MB, MINIMUM_SAVE_INTERVAL_MS } from "./consts";
|
||||
import { DIFF_CACHE_SIZE_MB } from "./consts";
|
||||
|
||||
export class SyncClient {
|
||||
private hasStartedOfflineSync = false;
|
||||
|
|
@ -157,9 +157,20 @@ export class SyncClient {
|
|||
database: undefined
|
||||
};
|
||||
|
||||
const settings = new Settings(
|
||||
logger,
|
||||
state.settings,
|
||||
async (data): Promise<void> => {
|
||||
state = { ...state, settings: data };
|
||||
// we're not rate-limiting settings saves as (1) we need to initialise the settings to know the rate limit
|
||||
// and (2) settings changes are infrequent enough that rate-limiting is not necessary
|
||||
await persistence.save(state);
|
||||
}
|
||||
);
|
||||
|
||||
const rateLimitedSave = rateLimit(
|
||||
persistence.save,
|
||||
MINIMUM_SAVE_INTERVAL_MS
|
||||
() => settings.getSettings().minimumSaveIntervalMs
|
||||
);
|
||||
|
||||
const database = new Database(
|
||||
|
|
@ -171,15 +182,6 @@ export class SyncClient {
|
|||
}
|
||||
);
|
||||
|
||||
const settings = new Settings(
|
||||
logger,
|
||||
state.settings,
|
||||
async (data): Promise<void> => {
|
||||
state = { ...state, settings: data };
|
||||
await rateLimitedSave(state);
|
||||
}
|
||||
);
|
||||
|
||||
const fetchController = new FetchController(
|
||||
settings.getSettings().isSyncEnabled,
|
||||
logger
|
||||
|
|
@ -201,6 +203,7 @@ export class SyncClient {
|
|||
const fileOperations = new FileOperations(
|
||||
logger,
|
||||
database,
|
||||
settings,
|
||||
fs,
|
||||
nativeLineEndings
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue