simple_scheduler 0.2.6 → 0.2.7

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
  SHA1:
3
- metadata.gz: d3a55a7af6ccb50338ca3a5f2450e65c7c1af819
4
- data.tar.gz: db2f18a6ec9a5b310ce617f464f878f32e2eb1ac
3
+ metadata.gz: cc8ab786b041bb9aa884a20fc7868b959b9007f5
4
+ data.tar.gz: 13eea6770174d5d114150cd50d51a8d10597269c
5
5
  SHA512:
6
- metadata.gz: e9cfafd8543ea5ccf7e3362d2711cc250fd6cc4ff215e387a87af59fc6bfde3ecc45131fd075ca14b812b51f9cfc41805b1be8120b5960d1ee0e4ec5b0ce260a
7
- data.tar.gz: ed8de9caaca0d9a8de0b6dd1899eb60f4114b56eda235823b0f871c81f75f874566d817e863e7729c52312ac17f79ebb764ed3103877e5ae54943dc0e553b24e
6
+ metadata.gz: 42828b1c2ce9c204dc0534bc88dfc773861fa7e97e949aa6b1a74a545c9258044de2df96b6c0e540ec27ebe2d63c3822b59aa18eb4ea2ecb2c51db3f7e8eff2b
7
+ data.tar.gz: 8b8e8872d57f94bfe8c0e7a5a1d18403532d0b85c81e7679138135670c60cf4b947d997145cb3eb901febc63a1e6a8af24bbf0f239b4bdf8e9fe6a0d435ddf39
data/README.md CHANGED
@@ -14,8 +14,8 @@ every hour, or every day.
14
14
 
15
15
  ## Production Ready?
16
16
 
17
- **Yes.** We are using Simple Scheduler in production for scheduling hourly,
18
- nightly, and weekly tasks in [Simple In/Out](https://www.simpleinout.com).
17
+ **Yes.** We are using Simple Scheduler in production for scheduling tasks that run
18
+ hourly, nightly, weekly, and every 10 minutes in [Simple In/Out](https://www.simpleinout.com).
19
19
 
20
20
  ### Why did we need to create yet another job scheduler?
21
21
 
@@ -71,6 +71,16 @@ module SimpleScheduler
71
71
  at_match[1].present?
72
72
  end
73
73
 
74
+ def next_hour
75
+ @next_hour ||= begin
76
+ next_hour = at_hour
77
+ # Add an additional hour if a specific hour wasn't given, if the minutes
78
+ # given are less than the current time's minutes.
79
+ next_hour += 1 if next_hour?
80
+ next_hour
81
+ end
82
+ end
83
+
74
84
  def next_hour?
75
85
  !hour? && at_min < now.min
76
86
  end
@@ -97,11 +107,14 @@ module SimpleScheduler
97
107
  return @parsed_time if @parsed_time
98
108
 
99
109
  @parsed_time = parsed_day
100
- change_hour = at_hour
110
+ change_hour = next_hour
111
+
112
+ # There is no hour 24, so we need to move to the next day
113
+ if change_hour == 24
114
+ @parsed_time = 1.day.from_now(@parsed_time)
115
+ change_hour = 0
116
+ end
101
117
 
102
- # Add an additional hour if a specific hour wasn't given, if the minutes
103
- # given are less than the current time's minutes.
104
- change_hour += 1 if next_hour?
105
118
  @parsed_time = @parsed_time.change(hour: change_hour, min: at_min)
106
119
 
107
120
  # If the parsed time is still before the current time, add an additional day if
@@ -1,3 +1,3 @@
1
1
  module SimpleScheduler
2
- VERSION = "0.2.6".freeze
2
+ VERSION = "0.2.7".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-17 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails