Repository navigation
T-131: A strict option that throws on a job file that fails to load - #38
Open
thetutlage wants to merge 1 commit into
Open
thetutlage wants to merge 1 commit into
thetutlage wants to merge 1 commit into
Conversation
With strict: true, Locator.registerFromGlob() and QueueManager.loadJobs() throw E_JOB_LOAD_FAILED for the first job file that fails to import, with the import error as its cause. Without it, the file is logged and skipped, as before. A worker process can use it to refuse to start with a broken job file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #37
Locator.registerFromGlob()logs a job file that fails to import and skips it, so the caller cannot know that the file failed.queue:workof@adonisjs/queuemust exit with code 1 when a job file fails to load (adonisjs/queue#13). This adds astrictoption that throws in place of the log.With no
strictoption, the behaviour is the same as in 0.10.0.Deployment requirements
@boringnode/queue: 0.11.0.Acceptance criteria
RegisterFromGlobOptions.strictthrowsE_JOB_LOAD_FAILEDat once, with the file in the message and the import error incause, and logs nothing. Test:strict throws E_JOB_LOAD_FAILED for a file that throws on importintests/locator.spec.ts.QueueManager.loadJobs(locations?, { strict })gives the option toregisterFromGlob(), andundefinedgives the configured locations. Tests:loadJobs with strict throws E_JOB_LOAD_FAILED for the configured locationsand... for explicit locationsintests/queue_manager.spec.ts.strict, the file is logged at theerrorlevel and skipped, and the other jobs are registered. Tests:should log and skip a file that fails to load, and register the other jobsintests/locator.spec.ts, and the existingshould log a job file that fails to load through the logger.E_JOB_LOAD_FAILEDis exported witherrors. File:src/exceptions.ts, exported byexport * as errorsofindex.ts.tests/locator.spec.tsandtests/queue_manager.spec.ts.README.mddocuments the option in the new section "Loading Jobs".Checks
yarn lint,yarn formatandyarn typecheckpass.yarn test: 1755 passed, 1 failed. The failure isSchedule dates migration | Knex (postgres) / reads dates whatever the DateStyle and TimeZone of the session. It fails the same way onmain(1749 passed, 1 failed), so it is not related to this change.Context changes
None.
Discovered work
Schedule dates migration | Knex (postgres) / reads dates whatever the DateStyle and TimeZone of the sessionfails onmainagainstpostgres:alpine: it gets1900-01-01T00:00:10.000Zwhere it expects1900-01-01T00:00:00.000Z.