resque-state 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee02ba0efe475ce49466785c81bc08757700c62e
4
- data.tar.gz: 72d383d06b2d4c659a5f36eb08b3a4d2fc5da06d
3
+ metadata.gz: 56b1a83d2e91b7ac03c1c7acb4070eccb33075c2
4
+ data.tar.gz: c144dda6b15b35f88e78f23a08d02b0da589ee81
5
5
  SHA512:
6
- metadata.gz: 51c852a08c55d06c4f2254c0c6a6f3336d72ea9586ee23e443fa605615de45bcab5ec3c940f77c1252ce20f8bad5b26f6d8e7414591b1a9bbe4991e6ee0b8134
7
- data.tar.gz: 1c31cbdbbf5fbe60f6e262e209d1dc07dad9191da971e4a2cbb92755c886b96ef919f41342d118d3bc2ce409c199d636a9b6bd011168bc54784c9acfe85ec65f
6
+ metadata.gz: b8dd4139d3dabd4804f95a1f1d156515f2a5aaebfaa76ccb3c13afc39a79bfb00ae85b3731fdd1637663919ba553abd0ed6c8e0081bd1558d9f550e10093c11e
7
+ data.tar.gz: ea5e97309395a4ed38eecec4e7bc41c4b61043a1668fd0f320d81fdc721c03f97e8ba2832404fb28622ea6c0d6aff651eb5f559496b039517ce43d1cb2a22b00
data/Gemfile CHANGED
@@ -1,15 +1,15 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'resque', '~>1.19'
3
+ gem 'resque', '~>1.27'
4
4
 
5
5
  group :test do
6
- gem 'mocha', '~>0.9'
7
- gem 'minitest', '~> 5.9'
8
- gem 'simplecov'
9
- gem 'fakeredis', '~> 0.5.0'
10
- gem "codeclimate-test-reporter", require: nil
6
+ gem 'codeclimate-test-reporter', require: nil
7
+ gem 'fakeredis', '~> 0.6'
8
+ gem 'minitest', '~> 5.10'
9
+ gem 'mocha', '~> 1.2'
10
+ gem 'simplecov', '~> 0.14'
11
11
  end
12
12
 
13
13
  group :development do
14
- gem 'jeweler', '~> 2.1'
14
+ gem 'jeweler', '~> 2.3'
15
15
  end
data/Gemfile.lock CHANGED
@@ -1,87 +1,93 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- addressable (2.4.0)
5
- builder (3.2.2)
6
- codeclimate-test-reporter (0.6.0)
7
- simplecov (>= 0.7.1, < 1.0.0)
4
+ addressable (2.5.1)
5
+ public_suffix (~> 2.0, >= 2.0.2)
6
+ builder (3.2.3)
7
+ codeclimate-test-reporter (1.0.7)
8
+ simplecov
8
9
  descendants_tracker (0.0.4)
9
10
  thread_safe (~> 0.3, >= 0.3.1)
10
11
  docile (1.1.5)
11
- fakeredis (0.5.0)
12
- redis (~> 3.0)
12
+ fakeredis (0.6.0)
13
+ redis (~> 3.2)
13
14
  faraday (0.9.2)
14
15
  multipart-post (>= 1.2, < 3)
15
16
  git (1.3.0)
16
- github_api (0.14.5)
17
- addressable (~> 2.4.0)
18
- descendants_tracker (~> 0.0.4)
17
+ github_api (0.11.3)
18
+ addressable (~> 2.3)
19
+ descendants_tracker (~> 0.0.1)
19
20
  faraday (~> 0.8, < 0.10)
20
- hashie (>= 3.4)
21
- oauth2 (~> 1.0)
22
- hashie (3.4.4)
21
+ hashie (>= 1.2)
22
+ multi_json (>= 1.7.5, < 2.0)
23
+ nokogiri (~> 1.6.0)
24
+ oauth2
25
+ hashie (3.5.5)
23
26
  highline (1.7.8)
24
- jeweler (2.1.1)
27
+ jar-dependencies (0.3.11)
28
+ jeweler (2.3.3)
25
29
  builder
26
30
  bundler (>= 1.0)
27
31
  git (>= 1.2.5)
28
- github_api
32
+ github_api (~> 0.11.0)
29
33
  highline (>= 1.6.15)
30
34
  nokogiri (>= 1.5.10)
35
+ psych (~> 2.2)
31
36
  rake
32
37
  rdoc
33
- semver
34
- json (1.8.3)
35
- json (1.8.3-java)
36
- jwt (1.5.4)
38
+ semver2
39
+ json (2.1.0)
40
+ json (2.1.0-java)
41
+ jwt (1.5.6)
37
42
  metaclass (0.0.4)
38
43
  mini_portile2 (2.1.0)
39
- minitest (5.9.0)
40
- mocha (0.14.0)
44
+ minitest (5.10.1)
45
+ mocha (1.2.1)
41
46
  metaclass (~> 0.0.1)
42
47
  mono_logger (1.1.0)
43
48
  multi_json (1.12.1)
44
- multi_xml (0.5.5)
49
+ multi_xml (0.6.0)
45
50
  multipart-post (2.0.0)
46
- nokogiri (1.6.8)
51
+ nokogiri (1.6.8.1)
47
52
  mini_portile2 (~> 2.1.0)
48
- pkg-config (~> 1.1.7)
49
- nokogiri (1.6.8-java)
50
- oauth2 (1.2.0)
51
- faraday (>= 0.8, < 0.10)
53
+ nokogiri (1.6.8.1-java)
54
+ oauth2 (1.3.1)
55
+ faraday (>= 0.8, < 0.12)
52
56
  jwt (~> 1.0)
53
57
  multi_json (~> 1.3)
54
58
  multi_xml (~> 0.5)
55
59
  rack (>= 1.2, < 3)
56
- pkg-config (1.1.7)
57
- rack (1.6.4)
60
+ psych (2.2.4)
61
+ psych (2.2.4-java)
62
+ jar-dependencies (>= 0.1.7)
63
+ public_suffix (2.0.5)
64
+ rack (1.6.5)
58
65
  rack-protection (1.5.3)
59
66
  rack
60
- rake (11.2.2)
61
- rdoc (4.2.2)
62
- json (~> 1.4)
63
- redis (3.3.1)
64
- redis-namespace (1.5.2)
67
+ rake (12.0.0)
68
+ rdoc (5.1.0)
69
+ redis (3.3.3)
70
+ redis-namespace (1.5.3)
65
71
  redis (~> 3.0, >= 3.0.4)
66
- resque (1.26.0)
72
+ resque (1.27.4)
67
73
  mono_logger (~> 1.0)
68
74
  multi_json (~> 1.0)
69
75
  redis-namespace (~> 1.3)
70
76
  sinatra (>= 0.9.2)
71
77
  vegas (~> 0.1.2)
72
- semver (1.0.1)
73
- simplecov (0.12.0)
78
+ semver2 (3.4.2)
79
+ simplecov (0.14.1)
74
80
  docile (~> 1.1.0)
75
81
  json (>= 1.8, < 3)
76
82
  simplecov-html (~> 0.10.0)
77
83
  simplecov-html (0.10.0)
78
- sinatra (1.4.7)
84
+ sinatra (1.4.8)
79
85
  rack (~> 1.5)
80
86
  rack-protection (~> 1.4)
81
87
  tilt (>= 1.3, < 3)
82
- thread_safe (0.3.5)
83
- thread_safe (0.3.5-java)
84
- tilt (2.0.5)
88
+ thread_safe (0.3.6)
89
+ thread_safe (0.3.6-java)
90
+ tilt (2.0.7)
85
91
  vegas (0.1.11)
86
92
  rack (>= 1.0.0)
87
93
 
@@ -91,12 +97,12 @@ PLATFORMS
91
97
 
92
98
  DEPENDENCIES
93
99
  codeclimate-test-reporter
94
- fakeredis (~> 0.5.0)
95
- jeweler (~> 2.1)
96
- minitest (~> 5.9)
97
- mocha (~> 0.9)
98
- resque (~> 1.19)
99
- simplecov
100
+ fakeredis (~> 0.6)
101
+ jeweler (~> 2.3)
102
+ minitest (~> 5.10)
103
+ mocha (~> 1.2)
104
+ resque (~> 1.27)
105
+ simplecov (~> 0.14)
100
106
 
101
107
  BUNDLED WITH
102
- 1.12.5
108
+ 1.14.3
data/Rakefile CHANGED
@@ -10,12 +10,12 @@ begin
10
10
  gem.name = 'resque-state'
11
11
  gem.version = Resque::Plugins::State::VERSION.dup
12
12
  gem.summary = %(resque-state is an extension to the resque queue system
13
- that provides simple trackable jobs.).gsub("\n", ' ').squeeze(' ')
13
+ that provides simple trackable jobs.).tr("\n", ' ').squeeze(' ')
14
14
  gem.description = %(resque-state is an extension to the resque queue
15
15
  system that provides simple trackable jobs. It provides a
16
16
  Resque::Plugins::State::Hash class which can set/get the statuses of jobs
17
17
  and a Resque::Plugins::State class that, when included, provides easily
18
- trackable/killable/pausable jobs.).gsub("\n", ' ').squeeze(' ')
18
+ trackable/killable/pausable jobs.).tr("\n", ' ').squeeze(' ')
19
19
  gem.email = 'nathan.v@gmail.com'
20
20
  gem.homepage = 'http://github.com/nathan-v/resque-state'
21
21
  gem.rubyforge_project = 'nathan-v'
@@ -27,7 +27,7 @@ begin
27
27
  Jeweler::RubygemsDotOrgTasks.new
28
28
  rescue LoadError
29
29
  puts 'Jeweler (or a dependency) not available. Install it with: gem install'\
30
- ' jeweler'.gsub("\n", ' ').squeeze(' ')
30
+ ' jeweler'.tr("\n", ' ').squeeze(' ')
31
31
  end
32
32
 
33
33
  require 'rake/testtask'
@@ -1,12 +1,11 @@
1
1
  require 'resque/job_with_state' # in rails you would probably do this in an initializer
2
2
 
3
3
  # sleeps for _length_ seconds updating the status every second
4
-
5
4
  class SleepJob
6
5
  include Resque::Plugins::State
7
6
 
8
7
  def perform
9
- total = options.has_key?('length') ? options['length'].to_i : 1000
8
+ total = options.key?('length') ? options['length'].to_i : 1000
10
9
  num = 0
11
10
  while num < total
12
11
  at(num, total, "At #{num} of #{total}")
@@ -15,21 +14,19 @@ class SleepJob
15
14
  end
16
15
  completed
17
16
  end
18
-
19
17
  end
20
18
 
21
-
22
- if __FILE__ == $0
19
+ if __FILE__ == $PROGRAM_NAME
23
20
  # Make sure you have a worker running
24
21
  # rake -rexamples/sleep_job.rb resque:work QUEUE=statused
25
22
 
26
23
  # running the job
27
- puts "Creating the SleepJob"
28
- job_id = SleepJob.create :length => 100
24
+ puts 'Creating the SleepJob'
25
+ job_id = SleepJob.create length: 100
29
26
  puts "Got back #{job_id}"
30
27
 
31
28
  # check the status until its complete
32
- while status = Resque::Plugins::State::Hash.get(job_id) and !status.completed? && !status.failed?
29
+ while (status = Resque::Plugins::State::Hash.get(job_id)) && !status.completed? && !status.failed?
33
30
  sleep 1
34
31
  puts status.inspect
35
32
  end
@@ -1,4 +1,5 @@
1
1
  module Resque
2
+ # Add the class for stateful jobs
2
3
  class JobWithState
3
4
  include Resque::Plugins::State
4
5
  end
@@ -1,4 +1,6 @@
1
+ # Resque root module
1
2
  module Resque
3
+ # Resque::Plugins root module
2
4
  module Plugins
3
5
  # Resque::Plugins::State is a module your jobs will include.
4
6
  # It provides helper methods for updating the status/etc from within an
@@ -28,7 +30,7 @@ module Resque
28
30
  # end we update the status telling anyone listening to this job that its
29
31
  # complete.
30
32
  module State
31
- VERSION = '1.0.1'.freeze
33
+ VERSION = '1.0.3'.freeze
32
34
 
33
35
  STATUS_QUEUED = 'queued'.freeze
34
36
  STATUS_WORKING = 'working'.freeze
@@ -36,13 +38,15 @@ module Resque
36
38
  STATUS_FAILED = 'failed'.freeze
37
39
  STATUS_KILLED = 'killed'.freeze
38
40
  STATUS_PAUSED = 'paused'.freeze
41
+ STATUS_WAITING = 'waiting'.freeze
39
42
  STATUSES = [
40
43
  STATUS_QUEUED,
41
44
  STATUS_WORKING,
42
45
  STATUS_COMPLETED,
43
46
  STATUS_FAILED,
44
47
  STATUS_KILLED,
45
- STATUS_PAUSED
48
+ STATUS_PAUSED,
49
+ STATUS_WAITING
46
50
  ].freeze
47
51
 
48
52
  autoload :Hash, 'resque/plugins/state/hash'
@@ -57,6 +61,7 @@ module Resque
57
61
  base.extend(ClassMethods)
58
62
  end
59
63
 
64
+ # Methods required for launching a state-ready job
60
65
  module ClassMethods
61
66
  # The default queue is :statused, this can be ovveridden in the specific
62
67
  # job class to put the jobs on a specific worker queue
@@ -209,6 +214,12 @@ module Resque
209
214
  Resque::Plugins::State::Hash.should_pause?(uuid)
210
215
  end
211
216
 
217
+ # Checks against the lock list if this specific job instance should wait
218
+ # before starting
219
+ def locked?(key)
220
+ Resque::Plugins::State::Hash.locked?(key)
221
+ end
222
+
212
223
  # set the status of the job for the current itteration. <tt>num</tt> and
213
224
  # <tt>total</tt> are passed to the status as well as any messages.
214
225
  # This will kill the job if it has been added to the kill list with
@@ -279,6 +290,31 @@ module Resque
279
290
  end
280
291
  end
281
292
 
293
+ # lock against a provided or automatic key to prevent duplicate jobs
294
+ def lock!(key = nil)
295
+ lock = Digest::SHA1.hexdigest @options.to_json
296
+ lock = key if key
297
+ if locked?(lock)
298
+ messages = ["Waiting at #{Time.now} due to existing job"]
299
+ job_status('status' => STATUS_WAITING,
300
+ 'message' => messages[0])
301
+ while locked?(lock)
302
+ kill! if should_kill?
303
+ pause! if should_pause?
304
+ sleep 10
305
+ end
306
+ else
307
+ Resque::Plugins::State::Hash.lock(lock)
308
+ end
309
+ end
310
+
311
+ # unlock the provided or automatic key at the end of a job
312
+ def unlock!(key = nil)
313
+ lock = Digest::SHA1.hexdigest @options.to_json
314
+ lock = key if key
315
+ Resque::Plugins::State::Hash.unlock(lock)
316
+ end
317
+
282
318
  private
283
319
 
284
320
  def job_status(*args)
@@ -3,16 +3,20 @@ require 'securerandom'
3
3
  module Resque
4
4
  module Plugins
5
5
  module State
6
- # Resque::Plugins::State::Hash is a Hash object that has helper methods for dealing with
7
- # the common status attributes. It also has a number of class methods for
8
- # creating/updating/retrieving status objects from Redis
6
+ # Resque::Plugins::State::Hash is a Hash object that has helper methods
7
+ # for dealing with the common status attributes. It also has a number of
8
+ # class methods for creating/updating/retrieving status objects from Redis
9
9
  class Hash < ::Hash
10
- # Create a status, generating a new UUID, passing the message to the status
10
+ # Create a status, a new UUID, passing the message to the status
11
11
  # Returns the UUID of the new status.
12
12
  def self.create(uuid, *messages)
13
13
  set(uuid, *messages)
14
14
  redis.zadd(set_key, Time.now.to_i, uuid)
15
- redis.zremrangebyscore(set_key, 0, Time.now.to_i - @expire_in) if @expire_in
15
+ if @expire_in
16
+ redis.zremrangebyscore(
17
+ set_key, 0, Time.now.to_i - @expire_in
18
+ )
19
+ end
16
20
  uuid
17
21
  end
18
22
 
@@ -22,7 +26,7 @@ module Resque
22
26
  val ? Resque::Plugins::State::Hash.new(uuid, decode(val)) : nil
23
27
  end
24
28
 
25
- # Get multiple statuses by UUID. Returns array of Resque::Plugins::State::Hash
29
+ # Get statuses by UUID. Returns array of Resque::Plugins::State::Hash
26
30
  def self.mget(uuids)
27
31
  return [] if uuids.empty?
28
32
  status_keys = uuids.map { |u| status_key(u) }
@@ -33,8 +37,8 @@ module Resque
33
37
  end
34
38
  end
35
39
 
36
- # set a status by UUID. <tt>messages</tt> can be any number of strings or hashes
37
- # that are merged in order to create a single status.
40
+ # set a status by UUID. <tt>messages</tt> can be any number of strings
41
+ # or hashes that are merged in order to create a single status.
38
42
  def self.set(uuid, *messages)
39
43
  val = Resque::Plugins::State::Hash.new(uuid, *messages)
40
44
  redis.set(status_key(uuid), encode(val))
@@ -42,8 +46,8 @@ module Resque
42
46
  val
43
47
  end
44
48
 
45
- # clear statuses from redis passing an optional range. See `statuses` for info
46
- # about ranges
49
+ # clear statuses from redis passing an optional range. See `statuses`
50
+ # for info about ranges
47
51
  def self.clear(range_start = nil, range_end = nil)
48
52
  status_ids(range_start, range_end).each do |id|
49
53
  remove(id)
@@ -81,7 +85,8 @@ module Resque
81
85
  redis.zrem(set_key, uuid)
82
86
  end
83
87
 
84
- # Return <tt>num</tt> Resque::Plugins::State::Hash objects in reverse chronological order.
88
+ # Return <tt>num</tt> Resque::Plugins::State::Hash objects in reverse
89
+ # chronological order.
85
90
  # By default returns the entire set.
86
91
  # @param [Numeric] range_start The optional starting range
87
92
  # @param [Numeric] range_end The optional ending range
@@ -92,16 +97,18 @@ module Resque
92
97
  mget(ids).compact || []
93
98
  end
94
99
 
95
- # Return the <tt>num</tt> most recent status/job UUIDs in reverse chronological order.
100
+ # Return the <tt>num</tt> most recent status/job UUIDs in reverse
101
+ # chronological order.
96
102
  def self.status_ids(range_start = nil, range_end = nil)
97
103
  if range_end && range_start
98
- # Because we want a reverse chronological order, we need to get a range starting
99
- # by the higest negative number. The ordering is transparent from the API user's
100
- # perspective so we need to convert the passed params
104
+ # Because we want a reverse chronological order, we need to get a
105
+ # range starting by the higest negative number. The ordering is
106
+ # transparent from the API user's perspective so we need to convert
107
+ # the passed params
101
108
  (redis.zrevrange(set_key, range_start.abs, (range_end || 1).abs) || [])
102
109
  else
103
- # Because we want a reverse chronological order, we need to get a range starting
104
- # by the higest negative number.
110
+ # Because we want a reverse chronological order, we need to get a
111
+ # range starting by the higest negative number.
105
112
  redis.zrevrange(set_key, 0, -1) || []
106
113
  end
107
114
  end
@@ -180,8 +187,25 @@ module Resque
180
187
  redis.sismember(pause_key, uuid)
181
188
  end
182
189
 
183
- # The time in seconds that jobs and statuses should expire from Redis (after
184
- # the last time they are touched/updated)
190
+ # Set a lock key to allow jobs to run as singletons. Optional timeout in
191
+ # seconds
192
+ def self.lock(key, timeout = 3600)
193
+ redis.setnx("_lock-#{key}", key)
194
+ redis.expire("_lock-#{key}", timeout)
195
+ end
196
+
197
+ # Remove a key from the lock list
198
+ def self.unlock(key)
199
+ redis.srem("_lock-#{key}", key)
200
+ end
201
+
202
+ # Check whether a key on the wait list
203
+ def self.locked?(key)
204
+ redis.sismember("_lock-#{key}", key)
205
+ end
206
+
207
+ # The time in seconds that jobs and statuses should expire from Redis
208
+ # (after the last time they are touched/updated)
185
209
  class << self
186
210
  attr_reader :expire_in
187
211
  end
@@ -248,10 +272,10 @@ module Resque
248
272
  hash_accessor :num
249
273
  hash_accessor :total
250
274
 
251
- # Create a new Resque::Plugins::State::Hash object. If multiple arguments are passed
252
- # it is assumed the first argument is the UUID and the rest are status objects.
253
- # All arguments are subsequentily merged in order. Strings are assumed to
254
- # be messages.
275
+ # Create a new Resque::Plugins::State::Hash object. If multiple
276
+ # arguments are passed it is assumed the first argument is the UUID and
277
+ # the rest are status objects. All arguments are subsequentily merged in
278
+ # order. Strings are assumed to be messages.
255
279
  def initialize(*args)
256
280
  super nil
257
281
  base_status = {
@@ -266,8 +290,8 @@ module Resque
266
290
  replace(status_hash)
267
291
  end
268
292
 
269
- # calculate the % completion of the job based on <tt>status</tt>, <tt>num</tt>
270
- # and <tt>total</tt>
293
+ # calculate the % completion of the job based on <tt>status</tt>,
294
+ # <tt>num</tt> and <tt>total</tt>
271
295
  def pct_complete
272
296
  if completed?
273
297
  100
@@ -276,16 +300,16 @@ module Resque
276
300
  elsif failed?
277
301
  0
278
302
  else
279
- if total.nil?
280
- t = 1
281
- else t = total
282
- end
303
+ t = if total.nil?
304
+ 1
305
+ else total
306
+ end
283
307
  (((num || 0).to_f / t.to_f) * 100).to_i
284
308
  end
285
309
  end
286
310
 
287
- # Return the time of the status initialization. If set returns a <tt>Time</tt>
288
- # object, otherwise returns nil
311
+ # Return the time of the status initialization. If set returns a
312
+ # <tt>Time</tt> object, otherwise returns nil
289
313
  def time
290
314
  time? ? Time.at(self['time']) : nil
291
315
  end
@@ -302,8 +326,8 @@ module Resque
302
326
  !failed? && !completed? && !killed?
303
327
  end
304
328
 
305
- # Can the job be paused? failed, completed, paused, and killed jobs can't be
306
- # paused, for obvious reasons
329
+ # Can the job be paused? failed, completed, paused, and killed jobs
330
+ # can't be paused, for obvious reasons
307
331
  def pausable?
308
332
  !failed? && !completed? && !killed? && !paused?
309
333
  end
data/lib/resque/state.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  require 'resque'
2
2
 
3
+ # Resque root module
3
4
  module Resque
4
5
  autoload :JobWithState, "#{File.dirname(__FILE__)}/job_with_state"
6
+ # Resque::Plugins root module
5
7
  module Plugins
6
8
  autoload :State, "#{File.dirname(__FILE__)}/plugins/state"
7
9
  end
data/resque-state.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: resque-state 1.0.2 ruby lib
5
+ # stub: resque-state 1.0.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "resque-state".freeze
9
- s.version = "1.0.2"
9
+ s.version = "1.0.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
data/test/test_helper.rb CHANGED
@@ -11,9 +11,6 @@ require 'resque-state'
11
11
  require 'minitest/autorun'
12
12
  require 'mocha/setup'
13
13
  require 'fakeredis'
14
- require 'codeclimate-test-reporter'
15
-
16
- CodeClimate::TestReporter.start
17
14
 
18
15
  Resque.redis = Redis.new
19
16
 
@@ -8,7 +8,7 @@ class TestResquePluginsStatus < Minitest::Test
8
8
 
9
9
  describe 'Resque::Plugins::State' do
10
10
  before do
11
- Resque.redis.flushall
11
+ Redis.current.flushdb
12
12
  end
13
13
 
14
14
  describe '.create' do
@@ -4,7 +4,7 @@ require 'test_helper'
4
4
  class TestResquePluginsStatusHash < Minitest::Test
5
5
  describe 'Resque::Plugins::State::Hash' do
6
6
  before do
7
- Resque.redis.flushall
7
+ Redis.current.flushdb
8
8
  Resque::Plugins::State::Hash.expire_in = nil
9
9
  @uuid = Resque::Plugins::State::Hash.create(
10
10
  Resque::Plugins::State::Hash.generate_uuid
@@ -223,7 +223,7 @@ class TestResquePluginsStatusHash < Minitest::Test
223
223
  end
224
224
 
225
225
  it 'return an empty array when no statuses are available' do
226
- Resque.redis.flushall
226
+ Redis.current.flushdb
227
227
  statuses = Resque::Plugins::State::Hash.statuses
228
228
  assert_equal [], statuses
229
229
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-state
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Quint