Skip to content

Commit

Permalink
set initial new locks
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jan 30, 2021
1 parent c671199 commit 5bdc752
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,17 @@ async function renew() {
const room = roomArr[i];
if (room.vBrowser && room.vBrowser.id) {
// console.log('[RENEW] VM in room:', room.roomId, room.vBrowser.id);
// TODO: remove this after rolling out new lock: prefix, this is just to set the new locks initially
await redis?.set(
'lock:' + room.vBrowser.provider + ':' + room.vBrowser.id,
'1',
'NX'
);
// Renew the lock on the VM

await redis?.expire(
'lock:' + room.vBrowser.provider + ':' + room.vBrowser.id,
300
);
await redis?.expire('vbrowser:' + room.vBrowser.id, 300);

const expireTime = getStartOfDay() / 1000 + 86400;
if (room.vBrowser.creatorClientID) {
Expand Down

0 comments on commit 5bdc752

Please sign in to comment.