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

GC of solved captchas #50

Closed
hrj opened this issue Aug 5, 2020 · 2 comments
Closed

GC of solved captchas #50

hrj opened this issue Aug 5, 2020 · 2 comments
Assignees

Comments

@hrj
Copy link
Contributor

hrj commented Aug 5, 2020

  • Change solved column to an integer that counts number of times the captcha was solved
  • After every N captchas are created, delete the captchas that have been solved more than M times.
  • After every N*10 captchas are created, delete the captchas that have been solved more than M/2 times
  • Don't serve captchas that have been solved more than M/2 times

N and M need to be configurable, but for now, we can hard-code them to 1000 and 10 respectively.

@rr83019
Copy link
Contributor

rr83019 commented Sep 10, 2020

Updated design:

  • Only one parameter required: M, the limit of times a captcha can be solved. After this limit is reached the captcha will be retired and garbage collected.
  • Change solved column to an integer that counts number of times the captcha was solved, initialized to zero.
  • Add a timestamp column to the captcha map table, initialized with the current time whenever a captcha is served
  • Increment solved column when a captcha is solved
  • While selecting a new captcha to be served, the solved count should be less than M
  • For GC the solved count should be more than M and the last served time should be less than the current time - time to solve captcha
  • For the answer endpoint, it should accept the solution only if the last served time is less than the current time - time to solve
  • When the time to solve exceeds or incase of a captcha is garbage collected it should return an error status and ask to request for a new captcha

@hrj
Copy link
Contributor Author

hrj commented Sep 23, 2020

Closed via #52

@hrj hrj closed this as completed Sep 23, 2020
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

2 participants