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 +4 -4
- data/README.md +2 -2
- data/lib/simple_scheduler/at.rb +17 -4
- data/lib/simple_scheduler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8ab786b041bb9aa884a20fc7868b959b9007f5
|
4
|
+
data.tar.gz: 13eea6770174d5d114150cd50d51a8d10597269c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
18
|
-
nightly, and
|
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
|
|
data/lib/simple_scheduler/at.rb
CHANGED
@@ -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 =
|
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
|
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.
|
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-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|