Skip to content

Process SIGINT as SIGQUIT #256

Open
Open
@a0s

Description

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?

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions