chained_job 0.6.1 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chained_job/helpers.rb +4 -0
- data/lib/chained_job/process.rb +14 -1
- data/lib/chained_job/store_job_arguments.rb +1 -5
- data/lib/chained_job/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e9f9e1ba6cf71c7f15c911cadf78a528479803399a3cafb2c8c157dea1f58ee
|
4
|
+
data.tar.gz: daef22987adf62315249d58f35432fcef78f9e14e57387f993676991e35ef711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3a315ffdfb640453c743e1feea71066d36f7c0251d72e549d9621116137f906b49cafc4eab9205e4fbd18a1d1537b56ac04717f02df1e6d8ded496882d6741d
|
7
|
+
data.tar.gz: f006c04a8b0822eb035ca8cfca81a24694cc9c2581c25f4fba0de51e10a0d0d2d2b4f8cc786f7c77ba0114ee2cf3d862c422ca2ff88d56aaa024575465792496
|
data/lib/chained_job/helpers.rb
CHANGED
data/lib/chained_job/process.rb
CHANGED
@@ -22,13 +22,22 @@ module ChainedJob
|
|
22
22
|
with_hooks do
|
23
23
|
return finished_worker unless argument
|
24
24
|
|
25
|
-
|
25
|
+
begin
|
26
|
+
job_instance.process(argument)
|
27
|
+
rescue StandardError => e
|
28
|
+
push_job_arguments_back if handle_retry?
|
29
|
+
raise e
|
30
|
+
end
|
26
31
|
job_instance.class.perform_later(args, worker_id, job_tag)
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
30
35
|
private
|
31
36
|
|
37
|
+
def handle_retry?
|
38
|
+
job_instance.try(:handle_retry?)
|
39
|
+
end
|
40
|
+
|
32
41
|
def with_hooks
|
33
42
|
ChainedJob.config.around_chain_process.call(options) { yield }
|
34
43
|
end
|
@@ -72,5 +81,9 @@ module ChainedJob
|
|
72
81
|
def job_key
|
73
82
|
Helpers.job_key(job_arguments_key)
|
74
83
|
end
|
84
|
+
|
85
|
+
def push_job_arguments_back
|
86
|
+
ChainedJob.redis.rpush(redis_key, Helpers.serialize([argument]))
|
87
|
+
end
|
75
88
|
end
|
76
89
|
end
|
@@ -20,7 +20,7 @@ module ChainedJob
|
|
20
20
|
set_tag_list
|
21
21
|
|
22
22
|
array_of_job_arguments.each_slice(config.arguments_batch_size) do |sublist|
|
23
|
-
ChainedJob.redis.rpush(redis_key, serialize(sublist))
|
23
|
+
ChainedJob.redis.rpush(redis_key, Helpers.serialize(sublist))
|
24
24
|
end
|
25
25
|
|
26
26
|
ChainedJob.redis.expire(redis_key, config.arguments_queue_expiration)
|
@@ -44,10 +44,6 @@ module ChainedJob
|
|
44
44
|
@job_key ||= Helpers.job_key(job_arguments_key)
|
45
45
|
end
|
46
46
|
|
47
|
-
def serialize(arguments)
|
48
|
-
arguments.map { |argument| Marshal.dump(argument) }
|
49
|
-
end
|
50
|
-
|
51
47
|
def config
|
52
48
|
ChainedJob.config
|
53
49
|
end
|
data/lib/chained_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chained_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mantas Kūjalis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|