Support Shoryuken

Open Beginner friendly
#719 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
ruby
Domain
backend

Research direction

Start by inspecting the bundled adapters and registration points in interruption_adapters.rb, then compare the proposed Shoryuken lifecycle handling with existing adapters. Update interruption_adapters.rb, the Gemfile, CHANGELOG, and README; done means Shoryuken is registered as a bundled adapter and the dependency and usage are documented.

Written by the indexing model from the issue text.

Description

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

Dominant language
Ruby
Stars
1.3k
Forks
61
Avg merge
1d 1h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Shopify/job-iteration

All issues in Shopify/job-iteration

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.