Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous forked workers #1

Closed
wants to merge 2 commits into from
Closed

Conversation

Inviz
Copy link
Owner

@Inviz Inviz commented May 14, 2014

This is a follow up PR to QueueClassic#218.

  • It adds :asynchronous option to workers that lets them finish their stuff in background.
  • It adds work {} block, that will be executed in forked context
  • It allows forked workers to use sql, but they are forced to reconnect in that case
  • Async worker's work() returns pid that you can wait on, but it's not necessary.

Inviz added 2 commits May 14, 2014 08:13
To achieve that, all logging actions are moved out to the parent process, so child process only does the workload and marshals it back to parent process. Forked workers should NOT re-use parent connection (sanity check added).

The code makes use of exit!(0) command, that triggers fast exit from a forked process, so postgres does not close the forked connection.

Adds specs for forked workers success/failure, mixed workers, connection reuse exception.
…nt process and log completion with a newly established connection
@Inviz Inviz closed this May 14, 2014
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