chained_job 0.4.1 → 0.5.0
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/process.rb +14 -1
- data/lib/chained_job/store_job_arguments.rb +5 -1
- 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: dd4890f548ef2ee47ff48180b593134f61b83fedc9017733346ab15d518d2c8d
|
4
|
+
data.tar.gz: c315bdee23b062ba3834bd23f8fcf18f07b8c7ca111dff9082d1bd251a5071e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0205f904ea84911f3258ac4798f52077c9e61e6850165db93b01b461ecbbf734d385093741211583aabddffcdda4e2cd4bc560ec10033dde9d5467f0232a28f5
|
7
|
+
data.tar.gz: 1e65c4a589d8db54ab53a76d80da2049a619945ed4a75428edf8aba28309a3e90b9ec222bb916fcd43842c945c38bf7fa9b881e9a5e2adefc90be92562fcf4eb
|
data/lib/chained_job/process.rb
CHANGED
@@ -48,7 +48,20 @@ module ChainedJob
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def argument
|
51
|
-
@argument ||=
|
51
|
+
@argument ||= deserialized_argument
|
52
|
+
end
|
53
|
+
|
54
|
+
def deserialized_argument
|
55
|
+
Marshal.load(serialized_argument)
|
56
|
+
rescue TypeError, ArgumentError
|
57
|
+
# backward compatibility
|
58
|
+
serialized_argument
|
59
|
+
end
|
60
|
+
|
61
|
+
def serialized_argument
|
62
|
+
return @serialized_argument if defined?(@serialized_argument)
|
63
|
+
|
64
|
+
@serialized_argument = ChainedJob.redis.lpop(redis_key)
|
52
65
|
end
|
53
66
|
|
54
67
|
def redis_key
|
@@ -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, sublist)
|
23
|
+
ChainedJob.redis.rpush(redis_key, serialize(sublist))
|
24
24
|
end
|
25
25
|
|
26
26
|
ChainedJob.redis.expire(redis_key, config.arguments_queue_expiration)
|
@@ -44,6 +44,10 @@ module ChainedJob
|
|
44
44
|
@job_key ||= Helpers.job_key(job_class)
|
45
45
|
end
|
46
46
|
|
47
|
+
def serialize(arguments)
|
48
|
+
arguments.map { |argument| Marshal.dump(argument) }
|
49
|
+
end
|
50
|
+
|
47
51
|
def config
|
48
52
|
ChainedJob.config
|
49
53
|
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.5.0
|
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: 2021-04-
|
12
|
+
date: 2021-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|