Skip to content

Commit

Permalink
add more console logs 2
Browse files Browse the repository at this point in the history
  • Loading branch information
davwas committed Nov 14, 2023
1 parent b78de7b commit e454d80
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/server/src/modules/tldraw/redis/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ export const getDocUpdatesFromQueue = async (redis: Redis.Redis, doc: WsSharedDo
redis.lrangeBuffer(getDocUpdatesKey(doc), 0, -1);

export const pushDocUpdatesToQueue = async (redis: Redis.Redis, doc: WsSharedDocDo, update: Uint8Array) => {
console.log('Entered pushDocUpdatesToQueue');
const len = await redis.llen(getDocUpdatesKey(doc));
console.log('pushDocUpdatesToQueue len: ', len);
if (len > 100) {
void redis
.pipeline()
.lpopBuffer(getDocUpdatesKey(doc))
.rpushBuffer(getDocUpdatesKey(doc), Buffer.from(update))
.expire(getDocUpdatesKey(doc), 300)
.exec();
console.log('pushDocUpdatesToQueue len > 100 after exec');
} else {
await redis
.pipeline()
.rpushBuffer(getDocUpdatesKey(doc), Buffer.from(update))
.expire(getDocUpdatesKey(doc), 300)
.exec();
console.log('pushDocUpdatesToQueue len <= 100 after exec');
}
};

0 comments on commit e454d80

Please sign in to comment.