chore: making the scheduler db not rely on env vars #2171
Merged
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.
Describe your changes
configuring the scheduler, which is a independant library, with env vars make it harder to understand where things are being configured and how. We ran into issues with the records package regarding default env vars value and behavior if/when not configured. With this commit the db url and schema are passed into the scheduler package and we don't have a global db object within the package. The
Tasks
function are now all takingdb
as their first parameter, this has the nice side effect to make it possible to run them in a transaction if needed.Checklist before requesting a review (skip if just adding/editing APIs & templates)