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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84c8c12fdb15c63dfa9fe2cb031382284e0eedcb2fdfad5f5af4d5dc8f01370a
4
- data.tar.gz: 467051fa730945c836e93222c8057b9c8e2a9d635a46e550db299cc99b36f380
3
+ metadata.gz: dd4890f548ef2ee47ff48180b593134f61b83fedc9017733346ab15d518d2c8d
4
+ data.tar.gz: c315bdee23b062ba3834bd23f8fcf18f07b8c7ca111dff9082d1bd251a5071e7
5
5
  SHA512:
6
- metadata.gz: b590497db0ae0fdb36f2e928da3bcb72c5c4ae7eabe5225a863d301ec27f462dda2f13c0a57f941eec07cf96b347935eed995835c67a89d3617d184516709f7a
7
- data.tar.gz: 98146d3133f14943b3a262014e6dba6e729cc019e945af887de311e416995b5dc52f4ba8f236c0d8df941cfec208de72712b19f1ad5ff8aeb89ceba2e4dd0d6b
6
+ metadata.gz: 0205f904ea84911f3258ac4798f52077c9e61e6850165db93b01b461ecbbf734d385093741211583aabddffcdda4e2cd4bc560ec10033dde9d5467f0232a28f5
7
+ data.tar.gz: 1e65c4a589d8db54ab53a76d80da2049a619945ed4a75428edf8aba28309a3e90b9ec222bb916fcd43842c945c38bf7fa9b881e9a5e2adefc90be92562fcf4eb
@@ -48,7 +48,20 @@ module ChainedJob
48
48
  end
49
49
 
50
50
  def argument
51
- @argument ||= ChainedJob.redis.lpop(redis_key)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChainedJob
4
- VERSION = '0.4.1'
4
+ VERSION = '0.5.0'
5
5
  end
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.1
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-09 00:00:00.000000000 Z
12
+ date: 2021-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler