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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49298780af4e1af7294623211a41bf0e0bbe2fa3238ac28d24074a8ce7102b36
4
- data.tar.gz: 5320ec84af3ba28e82627f28c68ef3278542ab1e37191b48d7feaf65cdaef354
3
+ metadata.gz: 660370465a4ff279d9bc26184108c07637d0fcd69f071e22e8dea9b5b79b29ae
4
+ data.tar.gz: 9e54efb1455b8e48af9d67011008cb821aefe6bb691ec0325f1f0a9c8425ed10
5
5
  SHA512:
6
- metadata.gz: 4efb829f41f8c13b94bf509b1b89688294142c61ada430d929a4a48322ee1be0d094a6492709348796b36aaf0479f3038c4db77402f169dcfa1e4343d5f31b30
7
- data.tar.gz: a3d24f54e91d2dc3c470749ebbd37e21d3a804befd00f46c43e32f6a85885f70c1cdd1bf052fa928497c619da1921e700c20b312f2088e2eeffdd618adbac370
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["REDIS_URL"]]
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Schked
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
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.0.0
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-10 00:00:00.000000000 Z
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redlock