Skip to content

Conversation

@promag
Copy link
Contributor

@promag promag commented Feb 1, 2017

This fixes an edge case when using ioredis:

  • get() executes mget which returns count, limit and reset;
  • suppose count is expired and the other 2 are about to expire;
  • since count is undefined then it will call create();
  • create() will set limit and reset but it won't work because of NX (keys still exist);
  • limit and reset expire, now only count is set.
  • the next get() will call decr() with undefined limit and reset which causes a loop.

There is no risk to overwrite limit and expire set by other session because, in that case, multi/exec would abort all sets due to the watched count.

@noamshemesh
Copy link
Collaborator

Thanks. I wont be near a computer until next week

@promag promag force-pushed the bugfix/handle-expired branch from d136212 to 82e2ba5 Compare February 2, 2017 16:34
@promag
Copy link
Contributor Author

promag commented Feb 7, 2017

I've pushed an alternative implementation in #33.

@promag promag closed this Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants