derhuerst/redis-stream

reader: fix race condition

Open

#6 opened on Jun 2, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (2 forks)github user discovery
bughelp wanted

Repository metrics

Stars
 (7 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

https://github.com/derhuerst/redis-stream/blob/bac7d4618750ea074b6411ca540341ccd1da9152/reader.js#L19-L55

read(size) will call xread(cursor), but set cursor in the callback. After multiple read() calls, their callbacks will race to overwrite cursor.

Contributor guide