Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async setHighestSyncBlock(dbName: string, blockNumber: number, syncing: boolean, rollback = false): Promise<PouchDB.UpsertResponse> {
- // NOTE: dbName, in this case, is actually the id of the record in the SyncStatus db.
- return this.db.upsert(dbName, (document: SyncDocument) => {
- // make sure the truly highest block is always being used
- document.blockNumber = rollback ? blockNumber : Math.max(blockNumber, document.blockNumber);
- document.syncing = syncing;
- // db.upsert sets _rev and _id so we don't have to
- return document;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement