Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttl on grant #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

ttl on grant #35

wants to merge 1 commit into from

Conversation

techfort
Copy link

sets a ttl on a zlist of ratelimit keys to avoid old keys lying around.

@@ -181,6 +181,11 @@ var grant = func(
return false, 0, errors.Wrap(err, "transaction failed")
}

_, err = conn.Do("EXPIRE", key, 60*60*24*30)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try adding this before the EXEC above? Then it's run in the same transaction, which should be slightly better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arp242 hey martin - good to see hear from you. No i purposely put this out the transaction block to ensure the ttl is only applied in case the transaction is successful. Wouldn't want to ttl the list if something went weird in the multi above. You could argue that the ttl applies in any case, i'll let @ripexz decide

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, just wasn't clear if you did it on purpose or if you just didn't notice. I don't really have an opinion other than that, although the transaction should be atomic(?)

Haven't seen you around since I got in Cork btw! Drop me a line at martin@arp242.net and we'll set up a date next week 😚 (I'll be leaving again after that)

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