Skip to content

Add after_forks_complete configuration hook#120

Open
supairish wants to merge 2 commits intobriandunn:masterfrom
princess-dentistry:after-forks-complete-hook
Open

Add after_forks_complete configuration hook#120
supairish wants to merge 2 commits intobriandunn:masterfrom
princess-dentistry:after-forks-complete-hook

Conversation

@supairish
Copy link
Copy Markdown

Summary

Adds an after_forks_complete hook to Flatware::Configuration, called once in the sink process after all workers have finished and all work is complete (just before DRb.stop_service).

This complements the existing before_fork and after_fork hooks by providing a place to run teardown logic that should happen exactly once after the entire parallel run — for example, cleaning up shared test databases or aggregating results.

Usage

Flatware.configure do |config|
  config.after_forks_complete do
    # runs once after all workers finish
  end
end

Changes

  • lib/flatware/configuration.rb — adds after_forks_complete accessor with the same pattern as before_fork / after_fork
  • lib/flatware/sink.rb — calls the hook in check_finished! before stopping DRb
  • spec/flatware/configuration_spec.rb — tests default noop behavior and block storage

Test plan

  • Existing specs pass
  • New spec verifies default is a callable noop
  • New spec verifies the configured block is invoked

@supairish
Copy link
Copy Markdown
Author

Note: the CI failure is a pre-existing RuboCop offense on master (lib/flatware/version.rb:4 — double quotes on the version string). It's unrelated to the changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant