-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [OPS-2310] Sidekiq parallel * Update usage * update config spec
- Loading branch information
Showing
13 changed files
with
141 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
/coverage/ | ||
/test.db | ||
/*.gem | ||
.byebug_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Patches | ||
module TenantRunConcern | ||
def run(tenant_name, path = nil) | ||
Apartment::Tenant.switch(tenant_name) | ||
Patches::Runner.new(path).perform | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'sidekiq' | ||
|
||
class Patches::TenantWorker | ||
include Sidekiq::Worker | ||
include Patches::TenantRunConcern | ||
|
||
sidekiq_options Patches::Config.configuration.sidekiq_options | ||
|
||
def perform(tenant_name, path) | ||
run(tenant_name, path) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Patches | ||
VERSION = "2.2.0" | ||
VERSION = "2.3.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
require "patches/tenant_run_concern" | ||
|
||
module Apartment | ||
module Tenant | ||
end | ||
end | ||
|
||
module Patches | ||
class DummyRun | ||
include TenantRunConcern | ||
end | ||
end | ||
|
||
describe Patches::TenantRunConcern do | ||
subject { Patches::DummyRun.new } | ||
|
||
let(:runner) { double(:runner) } | ||
|
||
describe '#run' do | ||
it 'calls instance perform' do | ||
expect(Apartment::Tenant).to receive(:switch).with('test') | ||
expect(Patches::Runner).to receive(:new).with('path').and_return(runner) | ||
expect(runner).to receive(:perform) | ||
subject.run('test', 'path') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
require "patches/tenant_worker" | ||
|
||
describe Patches::TenantWorker do | ||
describe '#perform' do | ||
specify do | ||
is_expected.to receive(:run).with('test', 'path') | ||
subject.perform('test', 'path') | ||
end | ||
end | ||
end |