I use the hash table to represent the people on the seat (key represents the seat position, value is the specific uid), and then use hsetnx to process the concurrent seat.
but there is a problem that, after the seat is successful, I have to deliver this message to the message queue (to notify the client), but there may be network reasons (or other reasons).
causes the delivery to fail, but redis has no transaction and cannot be rolled back. In this way, there will be problems. I don"t know if you have any good ideas. I take the liberty of asking for advice. The
pseudocode looks like this:
res = cache.setnx(pos, uid)
if (!res) {
throw new Exception("")
}
mq.send({
pos: pos,
uid: uid,
time: new Date()
})