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

Cache user registration status #62

Open
not-an-aardvark opened this issue Feb 23, 2017 · 0 comments
Open

Cache user registration status #62

not-an-aardvark opened this issue Feb 23, 2017 · 0 comments

Comments

@not-an-aardvark
Copy link
Contributor

Currently, if a command requires an account to be registered, the bot has to ping NickServ every single time a user attempts to use the command. This can cause commands to be slow, or can cause commands to fail if the status check times out.

We can get around this by caching registered nicks. However, it can't be time-based, because an imposter could join immediately after a registered account quits. So the cache should only be maintained as long as the bot can confirm that the user has not logged out.

  • When a user uses a command, the bot checks if the user's nick is in the "known to be registered" cache. If so, authentication passes. Otherwise, the bot checks with NickServ as it does now, and writes to the cache if the response is successful.
  • If a user changes their nickname, the old nickname should be evicted from the cache.
  • If a user quits the network, their nickname should be evicted from the cache.
  • If a user leaves all of the channels where the bot is present, their nickname should be evicted from the cache. Note that this requires reference counting for all the users in the bot's channels.
    • Along the same lines, if a user uses a command by PM and is not in any of the bot's channels, their registration status should not be cached.
  • If the bot gets disconnected or quits the network, the cache should be cleared.
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

No branches or pull requests

1 participant