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 OverflowError on Celery worker #3899

Merged
merged 1 commit into from
Jun 16, 2019

Conversation

guyco33
Copy link
Contributor

@guyco33 guyco33 commented Jun 12, 2019

What type of PR is this? (check all applicable)

  • Bug Fix

Description

next_iteration += datetime.timedelta(minutes=2**failures) start failing when number of failures is larger then 31 and celery worker stops refreshing queries

@guyco33 guyco33 force-pushed the Fix_OverflowError_on_celery_worker branch 3 times, most recently from 4872fa0 to f6cae5a Compare June 12, 2019 11:31
@guyco33 guyco33 changed the title Fix OverflowError on celery worker Fix OverflowError on Celery worker Jun 12, 2019
Copy link
Contributor

@rauchy rauchy left a comment

Choose a reason for hiding this comment

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

Looks good, thanks @guyco33.

One last thing - should_schedule_next has a pretty elaborate test suite, and I believe this case should be covered there as well. Can you add a test for this?

@guyco33 guyco33 force-pushed the Fix_OverflowError_on_celery_worker branch from f6cae5a to 6c1769a Compare June 13, 2019 14:29
@@ -130,7 +130,7 @@ def test_backoff(self):
failures=5))
self.assertFalse(models.should_schedule_next(two_hours_ago, now,
"3600", failures=10))

self.assertFalse(models.should_schedule_next(two_hours_ago, now, "3600", failures=32))
Copy link
Contributor

Choose a reason for hiding this comment

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

@guyco33 sorry for being a pain in the ass about this, but I'm a firm believer in one assert per test, and specifically, one logical assert per test.

The two assertions above the one you added are kind of related - they test the flip side of the same conditional, and belong in the same test (although this is debatable). The assertion you added feels like it tests a different concept, and I believe it should be separated.

Also - in the absence self-explanatory code, it's the tests' job to provide documentation, and just asserting "false" when failures=32 feels like a magic number with magic behavior. A dedicated test, with an explanatory test name, would really help here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rauchy I totally agree with you, especially when the tests cover special behaviour of magic numbers and unique corner cases.
I will pick a proper name for a new assertion and will update the PR accordingly

@guyco33 guyco33 force-pushed the Fix_OverflowError_on_celery_worker branch from 6c1769a to c8f0927 Compare June 14, 2019 06:43
@cypress
Copy link

cypress bot commented Jun 14, 2019



Test summary

63 0 0 0


Run details

Commit c8f0927
Started Jun 14, 2019 6:53 AM
Ended Jun 14, 2019 7:00 AM
Duration 06:26 💡
OS linux Debian - 8.10
Browser Electron 61.0.3163.100

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of your project's GitHub integration settings. You can manage this integration in your project's settings in the Cypress Dashboard

@rauchy rauchy merged commit 21a27ee into getredash:master Jun 16, 2019
@rauchy
Copy link
Contributor

rauchy commented Jun 16, 2019

Thanks @guyco33!

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