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

fix: Throttler does not show correct token time #5470

Merged
merged 3 commits into from
Dec 20, 2021

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Dec 15, 2021

Need to rebase after merging #5463.

Description
Fixes #5458

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Dec 15, 2021
@kenjis kenjis marked this pull request as draft December 15, 2021 07:45
@kenjis
Copy link
Member Author

kenjis commented Dec 15, 2021

I don't get why the tokenTime should be 0.
Why not 60?

// first check just creates a bucket, so tokenTime should be 0

@kenjis
Copy link
Member Author

kenjis commented Dec 17, 2021

After check() has been run and returned false, this method can be used to determine the time until a new token should be available and the action can be tried again.
https://codeigniter4.github.io/CodeIgniter4/libraries/throttler.html#getTokentime

It means when check() returned false, getTokentime() can't be used.
It returns 0.

@kenjis kenjis marked this pull request as ready for review December 17, 2021 08:18
@MGatner
Copy link
Member

MGatner commented Dec 18, 2021

Generally looks good, a couple questions inline.

@kenjis kenjis merged commit 491ce1b into codeigniter4:develop Dec 20, 2021
@kenjis kenjis deleted the fix-Throttle branch December 20, 2021 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Throttler does not show correct token time until 1 token is available
2 participants