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

bot: fix sometimes-undefined variable in flood protection #1638

Merged
merged 1 commit into from
Jun 7, 2019

Conversation

dgw
Copy link
Member

@dgw dgw commented Jun 7, 2019

Since elapsed was defined the same way in both places, there's no reason it can't be defined just once instead, in a higher scope that allows using it in loop detection also.

The only stumbling block is the fact that the sensible default value for elapsed (0) would trigger logic that shouldn't be triggered. And we can't use the other sensible default (None) because you can't apply operations like < to NoneType. So I picked an arbitrary default.

This is an important follow-up to #1518 and will bypass our general FIFO merge policy.

Since `elapsed` was defined the same way in both places, there's no
reason it can't be defined just once instead, in a higher scope that
allows using it in loop detection also.

The only stumbling block is the fact that the sensible default value for
`elapsed` (0) would trigger logic that shouldn't be triggered. And we
can't use the other sensible default (`None`) because you can't apply
operations like `<` to `NoneType`. So I picked an arbitrary default.
@dgw dgw added High Priority Bugfix Generally, PRs that reference (and fix) one or more issue(s) labels Jun 7, 2019
@dgw dgw added this to the 7.0.0 milestone Jun 7, 2019
@dgw dgw requested a review from a team June 7, 2019 06:38
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

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

Ok yeah that's good enough for a hotfix on master. 🚢 when you wake up. :)

@dgw dgw merged commit 5d81326 into master Jun 7, 2019
@dgw dgw deleted the fix-loop-detection branch August 18, 2019 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s) High Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants