atomic session update #40

Closed
furtivefelon opened this Issue Feb 26, 2012 · 1 comment

Comments

Projects
None yet
2 participants

Hey guys,

I am trying to manage uploads through sessions, so for every uploaded file, a new entry will be made in the req.session object. Since i support concurrent uploads, if i just do req.session.photos[photo.id] = photo; req.session.save(); There could possibly be race conditions since the updates are not atomic (where a later save would just override the earlier req.session.photos object)

can someone enlighten me whether it is possible to get atomic updates (since redis does support atomic update)?

Thanks a lot :)

Jason

@ghost

ghost commented Mar 23, 2012

A good place to start is to look at redis's multi/exec support, also the watch capability. You can trigger a watch on a new entry or old, and if anything alters it while a group of commands are being executed, you can have it notify and then disable or stop the new incoming command/request. I would start there to reach a solution .

Collaborator

chirag04 commented Oct 28, 2013

chirag04 closed this Oct 28, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment