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.
This is a follow-up to #81.
I've updated the
before_fork
andafter_fork
callbacks. Here's the nuts and bolts:before_fork
is called by DelayedJob only on the parent process, which doesn't ever execute jobs. Since this doesn't need to talk to the DB, we should ensure it's Mongoid connections are closed.after_fork
is called on child processes as they are forked from the parent. I've updated the logic to obtain fresh connections. Technically speaking this is not necessary as a Mongoid 5+, because the Mongo Ruby Driver checks if pid to see if it has been forked. However, since we know we are forking it's good practice to do this immediately rather than waiting for Mongo Driver to do it.In addition, this PR make some Job class method private which should not be exposed publicly.
I've added specs to increase coverage. I've also removed the YARDstick gem which verifies documentation. Bye-bye.