schked 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/schked/config.rb +9 -2
- data/lib/schked/version.rb +1 -1
- data/lib/schked/worker.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660370465a4ff279d9bc26184108c07637d0fcd69f071e22e8dea9b5b79b29ae
|
4
|
+
data.tar.gz: 9e54efb1455b8e48af9d67011008cb821aefe6bb691ec0325f1f0a9c8425ed10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0ee5ac189460a35c87da4c6a889482f824985abd5561f5541e01157b6574e7d28957b9082cab272fc2cce04e779850ced784858e91da02554b3816a37483fee
|
7
|
+
data.tar.gz: 68754d88a2fcc870c6e161d951b2ff2a00749d0c345401e9608c69cfde4055554f1275157b1e7af7c3a2f07efff037eb690619834daa3d289293ef33c27be6ac
|
data/lib/schked/config.rb
CHANGED
@@ -6,7 +6,8 @@ module Schked
|
|
6
6
|
class Config
|
7
7
|
attr_writer :logger,
|
8
8
|
:do_not_load_root_schedule,
|
9
|
-
:redis_servers
|
9
|
+
:redis_servers,
|
10
|
+
:standalone
|
10
11
|
|
11
12
|
def paths
|
12
13
|
@paths ||= []
|
@@ -35,7 +36,13 @@ module Schked
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def redis_servers
|
38
|
-
@redis_servers ||= [ENV
|
39
|
+
@redis_servers ||= [ENV.fetch("REDIS_URL", "redis://127.0.0.1:6379")]
|
40
|
+
end
|
41
|
+
|
42
|
+
def standalone?
|
43
|
+
@standalone = ENV["RAILS_ENV"] == "test" || ENV["RACK_ENV"] == "test" if @standalone.nil?
|
44
|
+
|
45
|
+
!!@standalone
|
39
46
|
end
|
40
47
|
|
41
48
|
private
|
data/lib/schked/version.rb
CHANGED
data/lib/schked/worker.rb
CHANGED
@@ -7,12 +7,12 @@ module Schked
|
|
7
7
|
def initialize(config:)
|
8
8
|
@config = config
|
9
9
|
|
10
|
-
@locker = RedisLocker.new(config.redis_servers, lock_ttl: 40_000)
|
10
|
+
@locker = RedisLocker.new(config.redis_servers, lock_ttl: 40_000) unless config.standalone?
|
11
11
|
@scheduler = Rufus::Scheduler.new(trigger_lock: locker)
|
12
12
|
|
13
13
|
watch_signals
|
14
14
|
define_callbacks
|
15
|
-
define_extend_lock
|
15
|
+
define_extend_lock unless config.standalone?
|
16
16
|
load_schedule
|
17
17
|
end
|
18
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Misha Merkushin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redlock
|