resque-stagger 0.3.0 → 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
  SHA256:
3
- metadata.gz: 53ae0e00d2158526b7b4fe759c68de683ef0d3c7d1f93db8723e36c470f92e21
4
- data.tar.gz: 02c043493d56f334c2848916a411383ab6bf1cad5e4b66c7cab75386f7cf45a0
3
+ metadata.gz: 159e7ada89f6f00107b1445850c12eedfa73ad6dd5e45cbc806e286467b5a964
4
+ data.tar.gz: 8f0bb3379c3f431729907b1c652b62fbb6ed55319bef75569b683d7b87d55e27
5
5
  SHA512:
6
- metadata.gz: 15ecf8e1b4d1e84d0a5cd796317e3e1220b7441ff63e27ec37f5a14c486cc8ec676b2591177dc2c50f08eacbb1202f95b598c6d21b9e87d19f8319d936e656b2
7
- data.tar.gz: 728cd6efa8a97aa900e280fa2f939705bf711046fc1f0bef6a7157def42da8e6a6c46940573ad99280be240d0ec73f01951b7a6e67fa67db223268f2ed71bc2b
6
+ metadata.gz: 50e12311484c9454639c035ef8ac8165ace0ccec1841454ea47305245083563678361ffd8e94c25ef5cca1f31f46c2d39328b0c2cc2db8b5946d27670eb3de07
7
+ data.tar.gz: ae8b9148e21084f60462a8e668900d205b58dd02c9624e16025c9805e62560b84cd72c6a5ea17db01e51f66bd11c627bdc9daa027a84e4d1fe849c49695cf225
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  .idea
13
+ *.gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ ## 0.2.1
2
+
3
+ ### Added
4
+
5
+ * Staggering functionality
6
+
7
+ ## 0.3.0
8
+
9
+ ### Added
10
+
11
+ * Queue name can be given on runtime
12
+
13
+ ## 1.0.2
14
+
15
+ ### Fixed
16
+
17
+ * Improper way of prepending module
18
+
19
+ ### Added
20
+
21
+ * Functionality to enqueue single job in a non-unit time range.
22
+ For example, earlier "n" jobs could have been scheduled per unit time,
23
+ i.e. in 1 second, but now it can be done both ways i.e. 1 job can be
24
+ scheduled to be enqueued per 5 seconds as well as 5 jobs can be
25
+ scheduled to be enqueued in 1 second.
26
+
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # Resque Stagger
1
+ # Resque-Stagger
2
2
 
3
- A Resque plugin for adding a stagger effect to enqueuing jobs.
3
+ resque-stagger is a simple Ruby gem that allows you to stagger the enqueuing of jobs
4
+ in [Resque](https://github.com/resque/resque).
4
5
 
5
6
  ## Installation
6
7
 
@@ -12,43 +13,48 @@ gem 'resque-stagger'
12
13
 
13
14
  And then execute:
14
15
 
15
- $ bundle install
16
+ ```shell
17
+ bundle install
18
+ ```
16
19
 
17
20
  Or install it yourself as:
18
21
 
19
- $ gem install resque-stagger
22
+ ```shell
23
+ gem install resque-stagger
24
+ ```
20
25
 
21
26
  ## Usage
22
27
 
23
- You can use `Resque::Staggered` to enqueue jobs with a stagger effect.
24
-
25
28
  ```ruby
26
- require "resque/stagger"
27
-
28
- staggered = Resque::Staggered.new(per_second: 2, start_from: Time.now + 5.seconds, queue: :low)
29
-
30
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds
31
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds
32
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 1.second
33
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 1.second
34
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 2.second
35
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 2.second
36
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 3.second
37
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 3.second
38
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 4.second
39
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 4.second
40
- staggered.enqueue(MyJob, "arg1", "arg2") # This will be enqueued at Time.now + 5.seconds + 5.second
41
-
29
+ require 'resque/staggered'
30
+
31
+ # Set up a new staggered queue
32
+ queue = Resque::Staggered.new(
33
+ start_from: Time.now + 60, # Start queuing jobs 60 seconds from now
34
+ number_of_jobs: 10, # Enqueue 10 jobs per time interval
35
+ unit_time_in_seconds: 300, # Interval of 5 minutes between each set of jobs
36
+ queue: 'low' # Enqueue jobs in the 'low' queue
37
+ )
38
+
39
+ # Enqueue a job with arguments
40
+ queue.enqueue(MyJobClass, arg1, arg2, arg3)
42
41
  ```
43
42
 
44
- The Staggered class takes three optional parameters: :per_second, :start_from and :queue.
43
+ - The code sets up a new staggered queue using Resque::Staggered and then enqueues a job with arguments using the
44
+ enqueue method of the staggered queue.
45
45
 
46
- > **:per_second** is the number of jobs to enqueue per second. The default value is nil, which means no limit on the number of jobs to enqueue per second.
46
+ - Based on the options passed to the Resque::Staggered constructor, the staggered queue will enqueue 10 jobs every 5
47
+ minutes (300 seconds) starting 60 seconds from the current time, and enqueue the jobs in the "low" queue.
47
48
 
48
- > **:start_from** is the starting time for enqueuing jobs. The default value is Time.current.
49
-
50
- > **:queue** is the queue you want to enqueue the staggered job at (when its time comes). Default value of queue is `nil` which is based on the assumption that the job class will be defining this queue explicitly and there is no need to give the queue name separately.
49
+ - So, if this code is run at 12:00 PM, the first set of 10 jobs will be enqueued at 12:01 PM (60 seconds later), the
50
+ second set of 10 jobs will be enqueued at 12:06 PM (5 minutes later), the third set of 10 jobs will be enqueued at 12:
51
+ 11 PM (5 minutes later), and so on.
51
52
 
52
53
  ## Contributing
53
54
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/parikshit223933/resque-stagger. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/parikshit223933/resque-stagger.
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of
60
+ the [MIT License](https://github.com/parikshit223933/resque-stagger/blob/master/LICENSE.txt).
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "resque/stagger"
4
+ require "resque/staggered"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module Stagger
3
- VERSION = "0.3.0"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,80 @@
1
+ require "resque/staggered/version"
2
+
3
+ module Resque
4
+ class Staggered
5
+ # Initializes a new Staggered object.
6
+ #
7
+ # @param options [Hash] The options to create the Staggered object with.
8
+ # @option options [Time] :start_from The time to start enqueueing jobs from (defaults to Time.current).
9
+ # @option options [Integer] :number_of_jobs The number of jobs to enqueue per unit time.
10
+ # @option options [Integer] :unit_time_in_seconds The time interval between each set of jobs.
11
+ # @option options [String] :queue The name of the queue to enqueue the jobs in (optional).
12
+ #
13
+ # @return [Staggered] A new instance of the Staggered class.
14
+ def initialize(**options)
15
+ @options = options
16
+ end
17
+
18
+ # Enqueues a job with the given arguments at a staggered time.
19
+ #
20
+ # @param klass [Object] The job class to enqueue.
21
+ # @param args [Array] The arguments to pass to the job.
22
+ #
23
+ # @return [void]
24
+ def enqueue(klass, *args)
25
+ if queue.present?
26
+ ::Resque.enqueue_at_with_queue(queue, current_enqueue_at, klass, *args)
27
+ else
28
+ ::Resque.enqueue_at(current_enqueue_at, klass, *args)
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ # Calculates the staggered time for the next job and returns it.
35
+ #
36
+ # @return [Time] The staggered time for the next job.
37
+ def current_enqueue_at
38
+ if number_of_jobs > @enqueues_in_last_unit_time.to_i
39
+ @enqueues_in_last_unit_time = @enqueues_in_last_unit_time.to_i + 1
40
+ if @unit_time_timestamp.nil?
41
+ return @unit_time_timestamp = starting_from
42
+ else
43
+ return @unit_time_timestamp
44
+ end
45
+ else
46
+ @enqueues_in_last_unit_time = 0
47
+ @unit_time_timestamp = @unit_time_timestamp + unit_time_in_seconds.second
48
+ current_enqueue_at
49
+ end
50
+ end
51
+
52
+ # Returns the time to start from.
53
+ #
54
+ # @return [Time] The time to start from.
55
+ def starting_from
56
+ @starting_from ||= @options[:start_from] || Time.current
57
+ end
58
+
59
+ # Returns the number of jobs to enqueue.
60
+ #
61
+ # @return [Integer] The number of jobs to enqueue.
62
+ def number_of_jobs
63
+ @options[:number_of_jobs] || nil
64
+ end
65
+
66
+ # Returns the time interval between each set of jobs.
67
+ #
68
+ # @return [Integer] The time interval between each set of jobs.
69
+ def unit_time_in_seconds
70
+ @options[:unit_time_in_seconds] || nil
71
+ end
72
+
73
+ # Returns the name of the queue to enqueue the jobs in.
74
+ #
75
+ # @return [String] The name of the queue to enqueue the jobs in.
76
+ def queue
77
+ @options[:queue] || nil
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,2 @@
1
+ require 'resque/staggered'
2
+ require 'resque/staggered/version'
@@ -1,6 +1,6 @@
1
1
  lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "resque/stagger/version"
3
+ require "resque/staggered/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "resque-stagger"
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/parikshit223933/resque-stagger"
20
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+ spec.metadata["changelog_uri"] = "https://github.com/parikshit223933/resque-stagger/blob/master/CHANGELOG.md"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -33,5 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
 
35
35
  spec.add_runtime_dependency 'resque', '>= 1.25'
36
+ spec.add_runtime_dependency 'activesupport', '>= 5.1.7'
36
37
  spec.add_runtime_dependency 'resque-scheduler', '>= 4.4.0'
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-stagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parikshit Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.25'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 5.1.7
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 5.1.7
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: resque-scheduler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -88,23 +102,19 @@ extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
104
  - ".gitignore"
91
- - ".idea/.gitignore"
92
- - ".idea/misc.xml"
93
- - ".idea/modules.xml"
94
- - ".idea/resque-stagger.iml"
95
- - ".idea/vcs.xml"
96
105
  - ".rspec"
97
106
  - ".travis.yml"
107
+ - CHANGELOG.md
98
108
  - CODE_OF_CONDUCT.md
99
109
  - Gemfile
100
- - LICENSE
101
110
  - LICENSE.txt
102
111
  - README.md
103
112
  - Rakefile
104
113
  - bin/console
105
114
  - bin/setup
106
- - lib/resque/stagger.rb
107
- - lib/resque/stagger/version.rb
115
+ - lib/resque-staggered.rb
116
+ - lib/resque/staggered.rb
117
+ - lib/resque/staggered/version.rb
108
118
  - resque-stagger.gemspec
109
119
  homepage: https://github.com/parikshit223933/resque-stagger
110
120
  licenses:
@@ -113,6 +123,7 @@ metadata:
113
123
  allowed_push_host: https://rubygems.org
114
124
  homepage_uri: https://github.com/parikshit223933/resque-stagger
115
125
  source_code_uri: https://github.com/parikshit223933/resque-stagger
126
+ changelog_uri: https://github.com/parikshit223933/resque-stagger/blob/master/CHANGELOG.md
116
127
  post_install_message:
117
128
  rdoc_options: []
118
129
  require_paths:
data/.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Editor-based HTTP Client requests
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
data/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.3-p62" project-jdk-type="RUBY_SDK" />
4
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/resque-stagger.iml" filepath="$PROJECT_DIR$/.idea/resque-stagger.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,36 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$">
8
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
- </content>
12
- <orderEntry type="jdk" jdkName="Remote: ruby-2.3.8-p459" jdkType="RUBY_SDK" />
13
- <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.2, Remote: ruby-2.3.8-p459) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="et-orbi (v1.2.7, Remote: ruby-2.3.8-p459) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="fugit (v1.8.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="mono_logger (v1.1.1, Remote: ruby-2.3.8-p459) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.15.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="mustermann (v2.0.2, Remote: ruby-2.3.8-p459) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="raabro (v1.4.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.4, Remote: ruby-2.3.8-p459) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.2.4, Remote: ruby-2.3.8-p459) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, Remote: ruby-2.3.8-p459) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="redis (v4.4.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="redis-namespace (v1.6.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="resque (v2.0.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="resque-scheduler (v4.4.0, Remote: ruby-2.3.8-p459) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="ruby2_keywords (v0.0.5, Remote: ruby-2.3.8-p459) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="rufus-scheduler (v3.8.2, Remote: ruby-2.3.8-p459) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="sinatra (v2.2.4, Remote: ruby-2.3.8-p459) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, Remote: ruby-2.3.8-p459) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.11, Remote: ruby-2.3.8-p459) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.10, Remote: ruby-2.3.8-p459) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="vegas (v0.1.11, Remote: ruby-2.3.8-p459) [gem]" level="application" />
35
- </component>
36
- </module>
data/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Parikshit Singh
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,74 +0,0 @@
1
- require "resque/stagger/version"
2
-
3
- # The Resque module contains the Stagger module.
4
- module Resque
5
- module Stagger
6
- # The Staggered class is used to enqueue jobs with a stagger effect.
7
- class Staggered
8
- # Initializes the Staggered class with given options.
9
- #
10
- # @param options [Hash] the options for the stagger effect.
11
- # @option options [Time] :start_from starting time for enqueuing jobs.
12
- # @option options [Integer] :per_second number of jobs to enqueue per second.
13
- # @option options [String] :queue name of the queue to enqueue jobs in.
14
- #
15
- # @return [void]
16
- def initialize(**options)
17
- @options = options
18
- end
19
-
20
- # Enqueues the given job with a stagger effect.
21
- #
22
- # @param klass [Class] the job class to be enqueued.
23
- # @param args [Array] the arguments for the job.
24
- #
25
- # @return [void]
26
- def enqueue(klass, *args)
27
- if queue.present?
28
- ::Resque.enqueue_at_with_queue(queue, current_enqueue_at, klass, *args)
29
- else
30
- ::Resque.enqueue_at(current_enqueue_at, klass, *args)
31
- end
32
- end
33
-
34
- private
35
-
36
- # Calculates the time at which the job should be enqueued.
37
- #
38
- # @return [Time, ActiveSupport::Duration] the enqueue time for the job.
39
- def current_enqueue_at
40
- return starting_from if per_second.to_i.zero?
41
- return @last_enqueued_at = starting_from if @last_enqueued_at.nil?
42
-
43
- @enqueued_last_second = @enqueued_last_second.to_i + 1
44
- return @last_enqueued_at if @enqueued_last_second < per_second.to_i
45
-
46
- @enqueued_last_second = 0
47
- @last_enqueued_at += 1.second
48
- end
49
-
50
- # Gets the starting time for enqueuing jobs.
51
- #
52
- # @return [Time] the starting time for enqueuing jobs.
53
- def starting_from
54
- @starting_from ||= @options[:start_from] || Time.current
55
- end
56
-
57
- # Gets the number of jobs to enqueue per second.
58
- #
59
- # @return [Integer, nil] the number of jobs to enqueue per second.
60
- def per_second
61
- @options[:per_second] || nil
62
- end
63
-
64
- # Returns the name of the queue to enqueue jobs in.
65
- #
66
- # @return [String, nil] the name of the queue, or nil if not specified.
67
- def queue
68
- @options[:queue] || nil
69
- end
70
- end
71
- end
72
- end
73
-
74
- Resque.prepend(Resque::Stagger)