1k-validators-be
1k-validators-be copied to clipboard
Scorekeeper Refactoring 2/4
First part https://github.com/w3f/1k-validators-be/pull/2934
Current PR changes:
- Localize behavior by bringing cron job initialization into the
Jobclass. - Remove
cron/StartCronJobs/,cron/SetupCronJobs/. - Remove the
JobNamesenum. - Add enums:
JobStatus,JobEvent,JobKey. - Clean up job modules.
- Add new tests.
Comments:
- There is almost no need for the events now, since
CronJobis a part of theJobclass. The only event that makes sense is theJobEvent.Progressevent. Job chaining is something to check; that could be a reason for having other event handlers. - There is no consistency in the logging strategy when working with labels and logging levels.
- There is a redundancy in the exception handling in the job functions.
- Not sure if it's the correct behavior.
jobFinishedevent will immediately overwritejobErroredstatus here https://github.com/w3f/1k-validators-be/blob/master/packages/common/src/scorekeeper/jobs/cron/SetupCronJob.ts#L63-L73
Impact:
- Package
common - Package
scorekeeper-status-ui
Potential next steps (to be discussed):
- [ ] Scorekeeper 1. First part of refactoring.
- [ ] Scorekeeper 2. Current PR.
- [ ] Scorekeeper 3. Add DB queries to store job status.
- [ ] Gateway. Update views to retrieve job statuses from the DB.
- [ ] Gateway. Remove Scorekeeper dependency.
- [ ] Core. Update Gateway initialization without Scorekeeper.
- [ ] Scorekeeper 4. Remove status updates via events and eliminate public interfaces related to the Gateway.
- [ ] Gateway. Reduce abstraction layers and code duplication in controllers.
- [ ] Gateway. Refactor dynamic routes (e.g.,
onlyHealthflag). - [ ] Deployment Update. Update deployment scripts to run services separately: Scorekeeper, Gateway, and Telemetry.