check_and_notify 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/check_and_notify/callbacks.rb +7 -0
- data/lib/check_and_notify/cron.rb +8 -0
- data/lib/check_and_notify/version.rb +1 -1
- data/lib/check_and_notify/workers/check_every_thirty_minutes_worker.rb +19 -0
- data/lib/check_and_notify/workers/slack_notifier_worker.rb +4 -0
- data/lib/check_and_notify.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66d5490a25990cb4f8e0e4d44750cef399926c0a
|
4
|
+
data.tar.gz: 13215b0ceb98cf00feb9e5f69a373cfabc1b0590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8062632f75cc4829786c3c4c9734b9adbfcfa5facc0ccfe257133aa79f50b07b5136b04c4e62bb292972a8b48682114ab5535920b575aca5a8f479b151c48d9c
|
7
|
+
data.tar.gz: 3aa02f03787d92d8c2f387b3d7b3e68528e58b7247ee2bd5eab02ad9e534e55931bda626dc6e6423bfc43c2e8b209d076787cfccc2ae77620f3d4fba2769e405
|
data/CHANGELOG.md
CHANGED
@@ -2,13 +2,20 @@ module CheckAndNotify
|
|
2
2
|
module Callbacks
|
3
3
|
mattr_accessor :check_after_one_hour_callbacks
|
4
4
|
mattr_accessor :check_after_ten_minutes_callbacks
|
5
|
+
mattr_accessor :check_after_thirty_minutes_callbacks
|
6
|
+
|
5
7
|
self.check_after_one_hour_callbacks = []
|
6
8
|
self.check_after_ten_minutes_callbacks = []
|
9
|
+
self.check_after_thirty_minutes_callbacks = []
|
7
10
|
|
8
11
|
def self.check_after_one_hour(&block)
|
9
12
|
self.check_after_one_hour_callbacks << block
|
10
13
|
end
|
11
14
|
|
15
|
+
def self.check_after_thirty_minutes(&block)
|
16
|
+
self.check_after_thirty_minutes_callbacks << block
|
17
|
+
end
|
18
|
+
|
12
19
|
def self.check_after_ten_minutes(&block)
|
13
20
|
self.check_after_ten_minutes_callbacks << block
|
14
21
|
end
|
@@ -22,5 +22,13 @@ module CheckAndNotify
|
|
22
22
|
class: 'CheckAndNotify::Workers::CheckEveryTenMinutesWorker'
|
23
23
|
})
|
24
24
|
end
|
25
|
+
|
26
|
+
def self.init_every_thirty_minutes_cron
|
27
|
+
Sidekiq::Cron::Job.create({
|
28
|
+
name: 'CheckEveryThirtyMinutesWorker',
|
29
|
+
cron: '*/30 * * * *',
|
30
|
+
class: 'CheckAndNotify::Workers::CheckEveryThirtyMinutesWorker'
|
31
|
+
})
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CheckAndNotify
|
2
|
+
module Workers
|
3
|
+
class CheckEveryThirtyMinutesWorker
|
4
|
+
include Sidekiq::Worker
|
5
|
+
sidekiq_options retry: 1
|
6
|
+
|
7
|
+
def perform
|
8
|
+
callbacks_size = CheckAndNotify::Callbacks.
|
9
|
+
check_after_thirty_minutes_callbacks.count
|
10
|
+
|
11
|
+
callbacks_size.times do |index|
|
12
|
+
SlackNotifierWorker.perform_async(
|
13
|
+
index, SlackNotifierWorker::EVERY_THIRTY_MINUTES
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -5,6 +5,7 @@ module CheckAndNotify
|
|
5
5
|
sidekiq_options retry: 1
|
6
6
|
|
7
7
|
EVERY_HOUR = 3600
|
8
|
+
EVERY_THIRTY_MINUTES = 1800
|
8
9
|
EVERY_TEN_MINUTES = 600
|
9
10
|
|
10
11
|
def perform(callback_index, callbacks_array_type)
|
@@ -12,6 +13,9 @@ module CheckAndNotify
|
|
12
13
|
when EVERY_HOUR
|
13
14
|
CheckAndNotify::Callbacks.
|
14
15
|
check_after_one_hour_callbacks[callback_index]
|
16
|
+
when EVERY_THIRTY_MINUTES
|
17
|
+
CheckAndNotify::Callbacks.
|
18
|
+
check_after_thirty_minutes_callbacks[callback_index]
|
15
19
|
when EVERY_TEN_MINUTES
|
16
20
|
CheckAndNotify::Callbacks.
|
17
21
|
check_after_ten_minutes_callbacks[callback_index]
|
data/lib/check_and_notify.rb
CHANGED
@@ -9,6 +9,7 @@ require "check_and_notify/callbacks"
|
|
9
9
|
require "check_and_notify/notifiers/slack"
|
10
10
|
require "check_and_notify/workers/slack_notifier_worker"
|
11
11
|
require "check_and_notify/workers/check_every_hour_worker"
|
12
|
+
require "check_and_notify/workers/check_every_thirty_minutes_worker"
|
12
13
|
require "check_and_notify/workers/check_every_ten_minutes_worker"
|
13
14
|
|
14
15
|
module CheckAndNotify
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_and_notify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Marion dela Cruz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/check_and_notify/version.rb
|
141
141
|
- lib/check_and_notify/workers/check_every_hour_worker.rb
|
142
142
|
- lib/check_and_notify/workers/check_every_ten_minutes_worker.rb
|
143
|
+
- lib/check_and_notify/workers/check_every_thirty_minutes_worker.rb
|
143
144
|
- lib/check_and_notify/workers/slack_notifier_worker.rb
|
144
145
|
homepage: https://github.com/carabao-capital/check_and_notify
|
145
146
|
licenses:
|