Skip to content

Support Shoryuken #719

Description

@luizlevindiniz

Hi, I am currently using maintenance_tasks with Shoryuken.

It appears that the job-iteration gem does not currently define an interruption_adapter for Shoryuken. Can we add one?
I have made a PR with it, but I can't push to the repo. The code is something like this:

# frozen_string_literal: true

begin
  require "shoryuken"
rescue LoadError
  # Shoryuken is not available, no need to load the adapter
  return
end

begin
  # Lifecycle event registration (Shoryuken.configure_server / config.on) was
  # introduced in Shoryuken 2.0.2.
  gem("shoryuken", ">= 2.0.2")
rescue Gem::LoadError
  warn("job-iteration's interruption adapter for Shoryuken requires Shoryuken 2.0.2 or newer")
  return
end

module JobIteration
  module InterruptionAdapters
    module ShoryukenAdapter
      class << self
        attr_accessor :stopping

        def call
          stopping
        end
      end

      Shoryuken.configure_server do |config|
        config.on(:shutdown) do
          ShoryukenAdapter.stopping = true
        end
      end
    end

    register(:shoryuken, ShoryukenAdapter)
  end
end

The rest of the code is quite simple:

  1. Add shoryuken in interruption_adapters.rb BUNDLED_ADAPTERS array.
  2. Update CHANGELOG and README
  3. Add shoryuken to the Gemfile

How can I contribute? Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions