Skip to content

Commit

Permalink
additional logs for worker
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Jul 18, 2024
1 parent abc6a4a commit 0537133
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,17 @@ export class Api {
const { room, docid } = decodeRedisRoomStreamName(task.stream, this.prefix)
// @todo, make sure that awareness by this.getDoc is eventually destroyed, or doesn't
// register a timeout anymore
logWorker('requesting doc from store')
const { ydoc, storeReferences, redisLastId, docChanged } = await this.getDoc(room, docid)
const lastId = math.max(number.parseInt(redisLastId.split('-')[0]), number.parseInt(task.id.split('-')[0]))
if (docChanged) {
try {
logWorker('doc changed, calling update callback')
await updateCallback(room, ydoc)
} catch (e) {
console.error(e)
}
logWorker('persisting doc')
await this.store.persistDoc(room, docid, ydoc)
}
await promise.all([
Expand Down

0 comments on commit 0537133

Please sign in to comment.