We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents be0a26a + cdc04ed commit 45de275Copy full SHA for 45de275
src/y-socket-io/y-socket-io.js
@@ -859,10 +859,13 @@ export class YSocketIO {
859
assert(this.client)
860
const redis = this.client.redis
861
const key = this.getLeaderKeyOf(namespace)
862
- const ok = await redis.set(key, this.serverId, {
+ const prevVal = await redis.set(key, this.serverId, {
863
NX: true,
864
- PX: PERSIST_LEADER_HEARTBEAT_INTERVAL
+ PX: PERSIST_LEADER_HEARTBEAT_INTERVAL,
865
+ GET: true
866
})
867
+
868
+ const ok = prevVal === this.serverId || prevVal === null
869
if (!ok) return false
870
871
this.persistentLeaderOf.add(namespace)
0 commit comments