Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. async setHighestSyncBlock(dbName: string, blockNumber: number, syncing: boolean, rollback = false): Promise<PouchDB.UpsertResponse> {
  2. // NOTE: dbName, in this case, is actually the id of the record in the SyncStatus db.
  3. return this.db.upsert(dbName, (document: SyncDocument) => {
  4. // make sure the truly highest block is always being used
  5. document.blockNumber = rollback ? blockNumber : Math.max(blockNumber, document.blockNumber);
  6. document.syncing = syncing;
  7.  
  8. // db.upsert sets _rev and _id so we don't have to
  9. return document;
  10. });
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement