que 1.0.0.beta2 → 1.0.0
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 +4 -4
- data/.github/workflows/tests.yml +43 -0
- data/CHANGELOG.md +242 -6
- data/README.md +55 -8
- data/bin/command_line_interface.rb +50 -26
- data/docs/README.md +785 -32
- data/lib/que/active_record/connection.rb +1 -1
- data/lib/que/active_record/model.rb +1 -1
- data/lib/que/connection.rb +11 -1
- data/lib/que/job_buffer.rb +27 -22
- data/lib/que/job_methods.rb +4 -0
- data/lib/que/locker.rb +27 -26
- data/lib/que/rails/railtie.rb +0 -2
- data/lib/que/sequel/model.rb +14 -16
- data/lib/que/version.rb +1 -1
- data/lib/que/worker.rb +37 -15
- data/que.gemspec +2 -2
- metadata +14 -30
- data/CHANGELOG.1.0.beta.md +0 -127
- data/docs/active_job.md +0 -6
- data/docs/advanced_setup.md +0 -49
- data/docs/command_line_interface.md +0 -45
- data/docs/error_handling.md +0 -94
- data/docs/inspecting_the_queue.md +0 -64
- data/docs/job_helper_methods.md +0 -27
- data/docs/logging.md +0 -31
- data/docs/managing_workers.md +0 -25
- data/docs/middleware.md +0 -36
- data/docs/migrating.md +0 -27
- data/docs/multiple_queues.md +0 -31
- data/docs/shutting_down_safely.md +0 -7
- data/docs/using_plain_connections.md +0 -65
- data/docs/using_sequel.md +0 -33
- data/docs/writing_reliable_jobs.md +0 -108
|
@@ -18,12 +18,14 @@ module Que
|
|
|
18
18
|
default_require_file: RAILS_ENVIRONMENT_FILE
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
-
options
|
|
22
|
-
queues
|
|
23
|
-
log_level
|
|
24
|
-
log_internals
|
|
25
|
-
poll_interval
|
|
26
|
-
connection_url
|
|
21
|
+
options = {}
|
|
22
|
+
queues = []
|
|
23
|
+
log_level = 'info'
|
|
24
|
+
log_internals = false
|
|
25
|
+
poll_interval = 5
|
|
26
|
+
connection_url = nil
|
|
27
|
+
worker_count = nil
|
|
28
|
+
worker_priorities = nil
|
|
27
29
|
|
|
28
30
|
parser =
|
|
29
31
|
OptionParser.new do |opts|
|
|
@@ -58,6 +60,26 @@ module Que
|
|
|
58
60
|
log_level = l
|
|
59
61
|
end
|
|
60
62
|
|
|
63
|
+
opts.on(
|
|
64
|
+
'-p',
|
|
65
|
+
'--worker-priorities [LIST]',
|
|
66
|
+
Array,
|
|
67
|
+
"List of priorities to assign to workers (default: 10,30,50,any,any,any)",
|
|
68
|
+
) do |priority_array|
|
|
69
|
+
worker_priorities =
|
|
70
|
+
priority_array.map do |p|
|
|
71
|
+
case p
|
|
72
|
+
when /\Aany\z/i
|
|
73
|
+
nil
|
|
74
|
+
when /\A\d+\z/
|
|
75
|
+
Integer(p)
|
|
76
|
+
else
|
|
77
|
+
output.puts "Invalid priority option: '#{p}'. Please use an integer or the word 'any'."
|
|
78
|
+
return 1
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
61
83
|
opts.on(
|
|
62
84
|
'-q',
|
|
63
85
|
'--queue-name [NAME]',
|
|
@@ -69,6 +91,15 @@ module Que
|
|
|
69
91
|
queues << queue_name
|
|
70
92
|
end
|
|
71
93
|
|
|
94
|
+
opts.on(
|
|
95
|
+
'-w',
|
|
96
|
+
'--worker-count [COUNT]',
|
|
97
|
+
Integer,
|
|
98
|
+
"Set number of workers in process (default: 6)",
|
|
99
|
+
) do |w|
|
|
100
|
+
worker_count = w
|
|
101
|
+
end
|
|
102
|
+
|
|
72
103
|
opts.on(
|
|
73
104
|
'-v',
|
|
74
105
|
'--version',
|
|
@@ -79,15 +110,6 @@ module Que
|
|
|
79
110
|
return 0
|
|
80
111
|
end
|
|
81
112
|
|
|
82
|
-
opts.on(
|
|
83
|
-
'-w',
|
|
84
|
-
'--worker-count [COUNT]',
|
|
85
|
-
Integer,
|
|
86
|
-
"Set number of workers in process (default: 6)",
|
|
87
|
-
) do |w|
|
|
88
|
-
options[:worker_count] = w
|
|
89
|
-
end
|
|
90
|
-
|
|
91
113
|
opts.on(
|
|
92
114
|
'--connection-url [URL]',
|
|
93
115
|
String,
|
|
@@ -130,19 +152,21 @@ module Que
|
|
|
130
152
|
) do |p|
|
|
131
153
|
options[:wait_period] = p
|
|
132
154
|
end
|
|
133
|
-
|
|
134
|
-
opts.on(
|
|
135
|
-
'--worker-priorities [LIST]',
|
|
136
|
-
Array,
|
|
137
|
-
"List of priorities to assign to workers, " \
|
|
138
|
-
"unspecified workers take jobs of any priority (default: 10,30,50)",
|
|
139
|
-
) do |p|
|
|
140
|
-
options[:worker_priorities] = p.map(&:to_i)
|
|
141
|
-
end
|
|
142
155
|
end
|
|
143
156
|
|
|
144
157
|
parser.parse!(args)
|
|
145
158
|
|
|
159
|
+
options[:worker_priorities] =
|
|
160
|
+
if worker_count && worker_priorities
|
|
161
|
+
worker_priorities.values_at(0...worker_count)
|
|
162
|
+
elsif worker_priorities
|
|
163
|
+
worker_priorities
|
|
164
|
+
elsif worker_count
|
|
165
|
+
Array.new(worker_count) { nil }
|
|
166
|
+
else
|
|
167
|
+
[10, 30, 50, nil, nil, nil]
|
|
168
|
+
end
|
|
169
|
+
|
|
146
170
|
if args.length.zero?
|
|
147
171
|
if File.exist?(default_require_file)
|
|
148
172
|
args << default_require_file
|
|
@@ -159,8 +183,8 @@ OUTPUT
|
|
|
159
183
|
args.each do |file|
|
|
160
184
|
begin
|
|
161
185
|
require file
|
|
162
|
-
rescue LoadError
|
|
163
|
-
output.puts "Could not load file '#{file}'"
|
|
186
|
+
rescue LoadError => e
|
|
187
|
+
output.puts "Could not load file '#{file}': #{e}"
|
|
164
188
|
return 1
|
|
165
189
|
end
|
|
166
190
|
end
|