resque-stagger 0.1.1 → 0.1.2

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: ccc8e147fff1acfa96e625f9f1b47e8d5d47f06a
4
- data.tar.gz: b221b934bee430939ca4a8140731238246a9423f
3
+ metadata.gz: a856cad256333d27eab77f6a0da0beb30296d44e
4
+ data.tar.gz: ed65145aa9a584c2b9a7063234532356b30bf198
5
5
  SHA512:
6
- metadata.gz: 0b3b6cf204b254b141ed10b3adcf045265dfaf2e962badf31cc758055dc574aeb382dab0a2e6f6fad6bb6aeff6f2007cb01c3c708f77f62aaf2c0b7638794e1b
7
- data.tar.gz: a5e5703f58bc2a4224926691d8d1c305676889d9b70b0b66d14a143ca690bbf1aac10aa061adf5be731e226e3661b93e83ac5c624d29b3aa7d6a08e073703306
6
+ metadata.gz: e860025fb48a92cf59fbccced17cb37744a8363220556d87c8cbf8e41bf2ba0b6f989b882df86d5bb3fd1b6e912ecaf1e6c604f7f3cd010966e1b3667b069d30
7
+ data.tar.gz: 5bc5ce9c16d12460f3bda711851656ddaac60692acb81268a8dfef9c3f119b5eeece5950dadae4a0dcc78ddf8f4dc0e2d741f148487fdbc83720968660e032c1
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module Stagger
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -8,19 +8,21 @@ module Resque
8
8
  end
9
9
 
10
10
  def enqueue(klass, *args)
11
- ::Resque.enqueue_at(current_enqueue_at, klass, *args)
11
+ # ::Resque.enqueue_at(current_enqueue_at, klass, *args)
12
+ puts current_enqueue_at
12
13
  end
13
14
 
14
15
  private
15
16
 
16
17
  def current_enqueue_at
17
- @__enqueued_last_second = @__enqueued_last_second.to_i + 1
18
18
  return starting_from if per_second.to_i.zero?
19
- return @__last_enqueued_at = starting_from if @__last_enqueued_at.blank?
20
- return @__last_enqueued_at if @__enqueued_last_second <= per_second
19
+ return @last_enqueued_at = starting_from if @last_enqueued_at.blank?
21
20
 
22
- @__enqueued_last_second = 0
23
- @__last_enqueued_at += 1.second
21
+ @enqueued_last_second = @enqueued_last_second.to_i + 1
22
+ return @last_enqueued_at if @enqueued_last_second < per_second
23
+
24
+ @enqueued_last_second = 0
25
+ @last_enqueued_at += 1.second
24
26
  end
25
27
 
26
28
  def starting_from
@@ -33,3 +35,5 @@ module Resque
33
35
  end
34
36
  end
35
37
  end
38
+
39
+ Resque.prepend(Resque::Stagger)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-stagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parikshit Singh