mini_scheduler 0.12.2 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -6
- data/Gemfile +1 -0
- data/Guardfile +1 -0
- data/README.md +1 -1
- data/Rakefile +15 -2
- data/lib/mini_scheduler/manager.rb +20 -4
- data/lib/mini_scheduler/version.rb +1 -1
- data/lib/mini_scheduler.rb +13 -2
- data/mini_scheduler.gemspec +3 -6
- metadata +19 -9
- data/.gitignore +0 -13
- data/.rspec +0 -1
- data/.rubocop.yml +0 -1
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319678529749db26d855d097741f1ff271bb3f19e87276eb764ede430f831d0e
|
4
|
+
data.tar.gz: e01a47b807bb03ee1f2f97a36f55d95663cb9a79b5cb87bb6fef64c45969c961
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 581b32d6f15869169797af99f68c3ffc4c137e54404b77a2f62948d8e448e822821fa24a56571d66355c96e16d2e38e321995b2b9f606e01caaeeec8aa8bc74a
|
7
|
+
data.tar.gz: 81467c469e97e95510dff3749d3efeedd7eb58344bb7ff30357979c05b8398fc9a75f282f8a8a60f0f8241861edafbcf4a85ff1091557f44236cc19d6fba5a01
|
data/CHANGELOG.md
CHANGED
@@ -1,25 +1,38 @@
|
|
1
|
-
# 0.
|
1
|
+
# 0.14.0 - 2022-06-20
|
2
|
+
|
3
|
+
- Fix compatibility with Sidekiq 6.5 (#15)
|
4
|
+
|
5
|
+
# 0.13.0 - 2020-11-30
|
6
|
+
|
7
|
+
- Fix exception code so it has parity with Sidekiq 4.2.3 and up, version bump cause
|
8
|
+
minimum version of Sikekiq changed.
|
9
|
+
|
10
|
+
# 0.12.3 - 2020-10-15
|
11
|
+
|
12
|
+
- Fixes a problem where scheduler didn't recover from Redis flush
|
13
|
+
|
14
|
+
# 0.12.2 - 2019-09-11
|
2
15
|
|
3
16
|
- Allow sorting schedule history by schedule name
|
4
17
|
|
5
|
-
# 0.12.1 -
|
18
|
+
# 0.12.1 - 2019-08-30
|
6
19
|
|
7
20
|
- Jobs that change family from per host to non per host can cause a tight loop
|
8
21
|
|
9
|
-
# 0.12.0 -
|
22
|
+
# 0.12.0 - 2019-08-29
|
10
23
|
|
11
24
|
- Add support for multiple workers which allows avoiding queue starvation
|
12
25
|
|
13
|
-
# 0.11.0 -
|
26
|
+
# 0.11.0 - 2019-06-24
|
14
27
|
|
15
28
|
- Correct situation where distributed mutex could end in a tight loop when
|
16
29
|
redis could not be contacted
|
17
30
|
|
18
|
-
# 0.9.2 -
|
31
|
+
# 0.9.2 - 2019-04-26
|
19
32
|
|
20
33
|
- Correct UI so it displays durations that are longer than a minute
|
21
34
|
|
22
|
-
# 0.9.1 -
|
35
|
+
# 0.9.1 - 2019-01-21
|
23
36
|
|
24
37
|
- Remove dependency on ActiveSupport and add proper dependency for Sidekiq
|
25
38
|
- Remove Discourse specific bits from Sidekiq web scheduler tab.
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://
|
1
|
+
[![Build Status](https://github.com/discourse/mini_scheduler/workflows/CI/badge.svg)](https://github.com/discourse/mini_scheduler/actions)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/mini_scheduler.svg)](https://rubygems.org/gems/mini_scheduler)
|
3
3
|
|
4
4
|
# mini_scheduler
|
data/Rakefile
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require "rspec/core/rake_task"
|
5
|
+
require 'bundler'
|
6
|
+
|
7
|
+
begin
|
8
|
+
Bundler.setup :default, :development
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
rescue Bundler::BundlerError => error
|
11
|
+
$stderr.puts error.message
|
12
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
13
|
+
exit error.status_code
|
14
|
+
end
|
3
15
|
|
4
16
|
RSpec::Core::RakeTask.new(:spec)
|
5
17
|
|
6
|
-
|
18
|
+
desc "Default: run tests"
|
19
|
+
task default: [ :spec ]
|
@@ -12,11 +12,12 @@ module MiniScheduler
|
|
12
12
|
@manager = manager
|
13
13
|
@hostname = manager.hostname
|
14
14
|
|
15
|
-
@
|
15
|
+
@recovery_thread = Thread.new do
|
16
16
|
while !@stopped
|
17
17
|
sleep 60
|
18
18
|
|
19
19
|
@mutex.synchronize do
|
20
|
+
repair_queue
|
20
21
|
reschedule_orphans
|
21
22
|
end
|
22
23
|
end
|
@@ -45,6 +46,12 @@ module MiniScheduler
|
|
45
46
|
MiniScheduler.handle_job_exception(ex, message: "Scheduling manager keep-alive")
|
46
47
|
end
|
47
48
|
|
49
|
+
def repair_queue
|
50
|
+
@manager.repair_queue
|
51
|
+
rescue => ex
|
52
|
+
MiniScheduler.handle_job_exception(ex, message: "Scheduling manager queue repair")
|
53
|
+
end
|
54
|
+
|
48
55
|
def reschedule_orphans
|
49
56
|
@manager.reschedule_orphans!
|
50
57
|
rescue => ex
|
@@ -85,7 +92,7 @@ module MiniScheduler
|
|
85
92
|
|
86
93
|
klass.new.perform
|
87
94
|
rescue => e
|
88
|
-
MiniScheduler.handle_job_exception(e, message: "Running a scheduled job", job: klass)
|
95
|
+
MiniScheduler.handle_job_exception(e, message: "Running a scheduled job", job: { "class" => klass })
|
89
96
|
|
90
97
|
error = "#{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
91
98
|
failed = true
|
@@ -122,10 +129,10 @@ module MiniScheduler
|
|
122
129
|
@stopped = true
|
123
130
|
|
124
131
|
@keep_alive_thread.kill
|
125
|
-
@
|
132
|
+
@recovery_thread.kill
|
126
133
|
|
127
134
|
@keep_alive_thread.join
|
128
|
-
@
|
135
|
+
@recovery_thread.join
|
129
136
|
|
130
137
|
enq(nil)
|
131
138
|
|
@@ -252,6 +259,15 @@ module MiniScheduler
|
|
252
259
|
nil
|
253
260
|
end
|
254
261
|
|
262
|
+
def repair_queue
|
263
|
+
return if redis.exists?(self.class.queue_key(queue)) ||
|
264
|
+
redis.exists?(self.class.queue_key(queue, hostname))
|
265
|
+
|
266
|
+
self.class.discover_schedules
|
267
|
+
.select { |schedule| schedule.queue == queue }
|
268
|
+
.each { |schedule| ensure_schedule!(schedule) }
|
269
|
+
end
|
270
|
+
|
255
271
|
def tick
|
256
272
|
lock do
|
257
273
|
schedule_next_job
|
data/lib/mini_scheduler.rb
CHANGED
@@ -4,7 +4,12 @@ require 'mini_scheduler/schedule'
|
|
4
4
|
require 'mini_scheduler/schedule_info'
|
5
5
|
require 'mini_scheduler/manager'
|
6
6
|
require 'mini_scheduler/distributed_mutex'
|
7
|
-
require 'sidekiq
|
7
|
+
require 'sidekiq'
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'sidekiq/exception_handler'
|
11
|
+
rescue LoadError
|
12
|
+
end
|
8
13
|
|
9
14
|
module MiniScheduler
|
10
15
|
|
@@ -13,7 +18,13 @@ module MiniScheduler
|
|
13
18
|
end
|
14
19
|
|
15
20
|
class SidekiqExceptionHandler
|
16
|
-
|
21
|
+
if defined?(Sidekiq::ExceptionHandler)
|
22
|
+
extend Sidekiq::ExceptionHandler
|
23
|
+
else
|
24
|
+
def self.handle_exception(exception, context)
|
25
|
+
Sidekiq.handle_exception(exception, context)
|
26
|
+
end
|
27
|
+
end
|
17
28
|
end
|
18
29
|
|
19
30
|
def self.job_exception_handler(&blk)
|
data/mini_scheduler.gemspec
CHANGED
@@ -15,14 +15,10 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = "https://github.com/discourse/mini_scheduler"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
18
|
-
|
19
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
21
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
-
end
|
18
|
+
spec.files = `git ls-files`.split($/).reject { |s| s =~ /^(spec|\.)/ }
|
23
19
|
spec.require_paths = ["lib"]
|
24
20
|
|
25
|
-
spec.add_dependency "sidekiq"
|
21
|
+
spec.add_dependency "sidekiq", ">= 4.2.3"
|
26
22
|
|
27
23
|
spec.add_development_dependency "pg", ">= 1.0"
|
28
24
|
spec.add_development_dependency "activesupport", ">= 5.2"
|
@@ -32,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
32
28
|
spec.add_development_dependency "guard-rspec"
|
33
29
|
spec.add_development_dependency "mock_redis"
|
34
30
|
spec.add_development_dependency "rake"
|
31
|
+
spec.add_development_dependency 'rubocop-discourse'
|
35
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 4.2.3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 4.2.3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: pg
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +137,20 @@ dependencies:
|
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rubocop-discourse
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
140
154
|
description: Adds recurring jobs for Sidekiq
|
141
155
|
email:
|
142
156
|
- neil.lalonde@discourse.org
|
@@ -144,10 +158,6 @@ executables: []
|
|
144
158
|
extensions: []
|
145
159
|
extra_rdoc_files: []
|
146
160
|
files:
|
147
|
-
- ".gitignore"
|
148
|
-
- ".rspec"
|
149
|
-
- ".rubocop.yml"
|
150
|
-
- ".travis.yml"
|
151
161
|
- CHANGELOG.md
|
152
162
|
- Gemfile
|
153
163
|
- Guardfile
|
@@ -187,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
197
|
- !ruby/object:Gem::Version
|
188
198
|
version: '0'
|
189
199
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
200
|
+
rubygems_version: 3.1.6
|
191
201
|
signing_key:
|
192
202
|
specification_version: 4
|
193
203
|
summary: Adds recurring jobs for Sidekiq
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--require spec_helper --color
|
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml
|