aws_cron 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/aws_cron/identity.rb +1 -1
- data/lib/aws_cron/runner.rb +18 -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: f738118da7f17c26961f99904538ce8c99db1415
|
4
|
+
data.tar.gz: ba0570b3818810e1767d6b0f9dff32d6aba34e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 669f655281b2f9c50471598ff530dd8c49d2f1fd30cc9283aa937efa62db6d9f50ecefb4ee0fc288d8ce334653eed176d9591fd2af80c42cf0006d94ced0db68
|
7
|
+
data.tar.gz: b5ffab3eaa67464489a182c85abca854f67c8c4405b6dd2ea830e1e3882cb4bb9ec3b45ed1d747ee157fe59b3faf1e38285667eefc04f26bd9b5069cada1c2c3
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# AwsCron
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/aws_cron)
|
4
|
+
[](https://circleci.com/gh/wealthsimple/aws_cron)
|
5
|
+
[](https://codeclimate.com/github/wealthsimple/aws_cron)
|
6
|
+
[](https://codecov.io/gh/wealthsimple/aws_cron)
|
7
|
+
[](https://gitter.im/wealthsimple/Lobby)
|
4
8
|
|
5
9
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
6
10
|
|
data/lib/aws_cron/identity.rb
CHANGED
data/lib/aws_cron/runner.rb
CHANGED
@@ -19,8 +19,25 @@ module AwsCron
|
|
19
19
|
|
20
20
|
def should_run(time)
|
21
21
|
last_execution_time = @cron.last(time)
|
22
|
+
next_execution_time = @cron.next(time)
|
22
23
|
|
23
|
-
|
24
|
+
# Addresses 'parse-cron' behaviour of not being able to tell
|
25
|
+
# if the cron schedule matches the current time.
|
26
|
+
# If your cron should run at 9AM, asking
|
27
|
+
# CronParser at exactly 9AM will yield:
|
28
|
+
# last: yesterday 9AM
|
29
|
+
# next: tomorrow 9AM
|
30
|
+
#
|
31
|
+
# But at 9:01AM, it will yield:
|
32
|
+
# last: today 9AM
|
33
|
+
# next: tomorrow 9AM
|
34
|
+
current_execution_time = @cron.last(time + 1.minute)
|
35
|
+
|
36
|
+
time_matches?(time, last_execution_time) || time_matches?(time, next_execution_time) || time_matches?(time, current_execution_time)
|
37
|
+
end
|
38
|
+
|
39
|
+
def time_matches?(time, reference_time)
|
40
|
+
time >= reference_time - @leniency_secs && time < reference_time + @leniency_secs
|
24
41
|
end
|
25
42
|
end
|
26
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_cron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Costa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|