interactor-sidekiq 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +33 -0
- data/README.md +3 -2
- data/lib/interactor/sidekiq/version.rb +1 -1
- data/lib/interactor/sidekiq.rb +1 -1
- data/spec/interactor/sidekiq_perform_spec.rb +1 -1
- data/spec/interactor/sidekiq_worker_spec.rb +0 -1
- metadata +3 -3
- data/.github/ci.yml +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9624b382ea330778b096bba8c2f547eef88be418ee9a23fb4c51b1e42fa1c12
|
4
|
+
data.tar.gz: 79e2ebc534be606659cb06395e190c08c1a3cc0e07877189b4af803cbad4db3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a9315375c3aa635d6892516f75e65d18fadcd606e0371316c052c1e998c573a3a6031ba046705250601dca8d24aa65be2c1da15da4e78df7267dd80344fbd15
|
7
|
+
data.tar.gz: 51c12fdff9946dd842742e85c8ccf57d2ffb511832b8fd75b6b840cc57952ac9c84bbcb94a47e45000b2951778e305ddbca820231a8357cbc20673024a405afa
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "master" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
ruby-version: ['2.6', '2.7', '3.0']
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v3
|
21
|
+
- name: Set up Ruby
|
22
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
23
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
24
|
+
# uses: ruby/setup-ruby@v1
|
25
|
+
uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby-version }}
|
28
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
29
|
+
- name: Rspec - Build and run tests
|
30
|
+
run: |
|
31
|
+
gem install bundler
|
32
|
+
bundle install --jobs 4 --retry 3
|
33
|
+
bundle exec rspec spec
|
data/README.md
CHANGED
@@ -47,8 +47,7 @@ In order to be able to schedule jobs for future execution following [Scheduled J
|
|
47
47
|
|
48
48
|
```sh
|
49
49
|
>> RegularAction.async_call(message: 'hello!', sidekiq_options: { queue: :low_priority }, sidekiq_schedule_options: { perform_in: 5 })
|
50
|
-
|
51
|
-
Interactor::Context message: 'hello!', sidekiq_options: { queue: :low_priority }, sidekiq_schedule_options: { perform_in: 5 }
|
50
|
+
#<Interactor::Context message="hello!", sidekiq_options={ queue: :low_priority }, sidekiq_schedule_options={ perform_in: 5 }>
|
52
51
|
```
|
53
52
|
|
54
53
|
## Failure
|
@@ -70,8 +69,10 @@ Now you need an interactor to always assume asynchronous behavior using: **Inter
|
|
70
69
|
#### Passing handle sidekiq exception
|
71
70
|
|
72
71
|
When executing the perform method in sidekiq there may be a problem, thinking about it we have already made it possible for you to handle this error.
|
72
|
+
|
73
73
|
**If the context is failed during invocation of the interactor in background, the Interactor::Failure is raised**.
|
74
74
|
|
75
|
+
Use self.method_name to customize your class: **self.sidekiq_options**, **self.sidekiq_schedule_options** and **self.handle_sidekiq_exception(error)**.
|
75
76
|
|
76
77
|
```ruby
|
77
78
|
class AsyncAction
|
data/lib/interactor/sidekiq.rb
CHANGED
@@ -25,7 +25,7 @@ module Interactor
|
|
25
25
|
include ::Sidekiq::Worker
|
26
26
|
|
27
27
|
def perform(context)
|
28
|
-
interactor_class(context).sync_call(context.
|
28
|
+
interactor_class(context).sync_call(context.reject { |c| ['interactor_class'].include? c.to_s })
|
29
29
|
rescue Exception => e
|
30
30
|
if interactor_class(context).respond_to?(:handle_sidekiq_exception)
|
31
31
|
interactor_class(context).handle_sidekiq_exception(e)
|
@@ -51,7 +51,7 @@ RSpec.describe Interactor::SidekiqWorker::Worker do
|
|
51
51
|
|
52
52
|
it { expect(result.success?).to eq true }
|
53
53
|
|
54
|
-
it { expect(result.to_h).to eq context.
|
54
|
+
it { expect(result.to_h).to eq context.reject { |c| ['interactor_class'].include? c.to_s } }
|
55
55
|
|
56
56
|
it_behaves_like 'there was no new sidekiq worker'
|
57
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interactor-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Rocha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: interactor
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- ".github/ci.yml"
|
48
|
+
- ".github/workflows/ci.yml"
|
49
49
|
- ".gitignore"
|
50
50
|
- ".rspec"
|
51
51
|
- Gemfile
|
data/.github/ci.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
- '*'
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
test:
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
steps:
|
11
|
-
- name: Check out repository code
|
12
|
-
uses: actions/checkout@v1
|
13
|
-
|
14
|
-
- name: Setup Ruby
|
15
|
-
uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: '3.0.3'
|
18
|
-
bundler-cache: true
|
19
|
-
|
20
|
-
- name: Rspec - Build and run tests
|
21
|
-
run: |
|
22
|
-
gem install bundler
|
23
|
-
bundle install --jobs 4 --retry 3
|
24
|
-
bundle exec rspec spec
|