Skip to content

Commit c0aa8a7

Browse files
committed
Bugfix and save poll state
1 parent 94340ff commit c0aa8a7

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/noteshandler.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ export class NotesConnection {
166166
}
167167
}
168168
})
169+
170+
{
171+
const pollstate = await this.getPollinfo(purenotes)
172+
if (pollstate) socket.emit(pollstate.command, pollstate.data)
173+
}
169174
}
170175

171176
async getNotesToken(oldtoken) {
@@ -296,7 +301,7 @@ export class NotesConnection {
296301
const boardnum = res[index]
297302
// console.log('sendBoardsToSocket', boardnum, lectureuuid)
298303
try {
299-
const res2 = await this.redis.getBuffer(
304+
const res2 = await this.redis.get(
300305
commandOptions({ returnBuffers: true }),
301306
'lecture:' + lectureuuid + ':board' + boardnum
302307
)
@@ -337,6 +342,20 @@ export class NotesConnection {
337342
}
338343
}
339344

345+
async getPollinfo(args) {
346+
try {
347+
const pollinfo = await this.redis.hGetAll(
348+
'lecture:' + args.lectureuuid + ':pollstate'
349+
)
350+
if (pollinfo.command && pollinfo.data)
351+
return { command: pollinfo.command, data: JSON.parse(pollinfo.data) }
352+
else return null
353+
} catch (error) {
354+
console.log('getPollInfo failed', error)
355+
return null
356+
}
357+
}
358+
340359
getRoomName(uuid) {
341360
return uuid
342361
}

0 commit comments

Comments
 (0)