-
Notifications
You must be signed in to change notification settings - Fork 21
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 sporadic flowauth fails #845
Conversation
… it to finish before serving requests
Codecov Report
@@ Coverage Diff @@
## master #845 +/- ##
==========================================
- Coverage 93.13% 93.07% -0.07%
==========================================
Files 130 130
Lines 6631 6657 +26
Branches 696 696
==========================================
+ Hits 6176 6196 +20
- Misses 331 337 +6
Partials 124 124
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #845 +/- ##
==========================================
+ Coverage 93.13% 93.16% +0.02%
==========================================
Files 130 130
Lines 6631 6657 +26
Branches 696 696
==========================================
+ Hits 6176 6202 +26
Misses 331 331
Partials 124 124
Continue to review full report at Codecov.
|
with app.app_context(): | ||
runner = app.test_cli_runner() | ||
app.config["DB_IS_SET_UP"].clear() | ||
result = runner.invoke(demodata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check: these two instances of runner.invoke(demodata)
will run in serial, i.e. the first one will definitely finish before the second one is run? Just want to make sure this test can't accidentally fail if they run concurrently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely serial.
with app.app_context(): | ||
runner = app.test_cli_runner() | ||
app.config["DB_IS_SET_UP"].clear() | ||
app.config["DB_IS_SETTING_UP"].set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically the use of DB_IS_SETTING_UP
as a flag is an internal implementation detail, but I can't think of an easy way to reliably trigger the test condition in a different way so I guess it's fine to use it in the test too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that's a good point - these should probably be on g
instead really. I'll change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍 Well done for identifying the cause of this issue.
Closes #844
I have:
Description
Added two multiprocessing
Event
s, which prevent more than one forked flowauth process from trying to initialise the database, or create demo data, and will cause others to wait until this is done.