Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #533. Instead of running a single worker loop, Backend will now run 4. I didn't change the timing of how a worker waits between work.
What has been done to verify that this works as intended?
Existing tests continue to pass, but tests usually run workers manually (via
exhaust()
). When they do run a loop, it's at most one loop. I think it's hard to really test multiple loops and that the best thing to do is just to get the PR merged before regression testing begins. If we run into performance or other issues during regression testing, we can address them then.Why is this the best possible solution? Were any other approaches considered?
I probably could have called the existing
worker()
function multiple times, but I noticed that each invocation ofworker()
would create functions tocheck
,run
, andreport
. Instead, I created a new function namedworkerQueue()
that will create all worker-related functions at once. That reduces the number of duplicate functions and I think is a little easier to understand.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
We already have concurrent workers in place because of our use of
pm2
, so I'm hoping we won't run into any issues.Before submitting this PR, please make sure you have:
make test-full
and confirmed all checks still pass OR confirm CircleCI build passes