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

Process SIGINT as SIGQUIT #256

Open
a0s opened this issue Feb 24, 2017 · 0 comments
Open

Process SIGINT as SIGQUIT #256

a0s opened this issue Feb 24, 2017 · 0 comments

Comments

@a0s
Copy link

a0s commented Feb 24, 2017

Hi gays! I try to found a way to process SIGINT as SIGQUIT (i want to wait of end of current job when i pressed Ctrl-C). And the only way to do this that i found is dirty override BaseWorker#register_signal_handlers

    module Qless
      module Workers
        class BaseWorker
          def register_signal_handlers
            trap('TERM') { exit! }
            # trap('INT') { exit! }
            trap('INT') { shutdown(in_signal_handler=true) }
            safe_trap('HUP') { sighup_handler.call }
            safe_trap('QUIT') { shutdown(in_signal_handler=true) }
            begin
              trap('CONT') { unpause(in_signal_handler=true) }
              trap('USR2') { pause(in_signal_handler=true) }
            rescue ArgumentError
              warn 'Signals USR2, and/or CONT not supported.'
            end
          end
        end
      end
    end

    worker = Qless::Workers::ForkingWorker.new(reserver, num_workers: WORKERS, logger: App.logger)
    worker.run

Did I miss something?

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

No branches or pull requests

1 participant