mirror of
https://github.com/Evolix/chexpire.git
synced 2024-05-10 04:28:38 +02:00
Schedule checks & notifications processors tasks
This commit is contained in:
parent
a286efdd88
commit
6561a6d8ed
2
Capfile
2
Capfile
|
@ -40,5 +40,7 @@ install_plugin Capistrano::Puma # Default puma tasks
|
||||||
# install_plugin Capistrano::Puma::Monit # if you need the monit tasks
|
# install_plugin Capistrano::Puma::Monit # if you need the monit tasks
|
||||||
# install_plugin Capistrano::Puma::Nginx # if you want to upload a nginx site template
|
# install_plugin Capistrano::Puma::Nginx # if you want to upload a nginx site template
|
||||||
|
|
||||||
|
require "whenever/capistrano"
|
||||||
|
|
||||||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
|
||||||
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
|
||||||
|
|
1
Gemfile
1
Gemfile
|
@ -38,6 +38,7 @@ gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
gem 'open4'
|
gem 'open4'
|
||||||
gem 'naught'
|
gem 'naught'
|
||||||
|
gem 'whenever', require: false
|
||||||
|
|
||||||
|
|
||||||
gem 'octicons'
|
gem 'octicons'
|
||||||
|
|
|
@ -91,6 +91,7 @@ GEM
|
||||||
chromedriver-helper (1.2.0)
|
chromedriver-helper (1.2.0)
|
||||||
archive-zip (~> 0.10)
|
archive-zip (~> 0.10)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
chronic (0.10.2)
|
||||||
coderay (1.1.2)
|
coderay (1.1.2)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
crass (1.0.4)
|
crass (1.0.4)
|
||||||
|
@ -308,6 +309,8 @@ GEM
|
||||||
websocket-driver (0.7.0)
|
websocket-driver (0.7.0)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.3)
|
websocket-extensions (0.1.3)
|
||||||
|
whenever (0.10.0)
|
||||||
|
chronic (>= 0.6.3)
|
||||||
xpath (3.0.0)
|
xpath (3.0.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
|
||||||
|
@ -357,6 +360,7 @@ DEPENDENCIES
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
web-console (>= 3.3.0)
|
web-console (>= 3.3.0)
|
||||||
webpacker (~> 3.5)
|
webpacker (~> 3.5)
|
||||||
|
whenever
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 2.5.1p57
|
ruby 2.5.1p57
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require "notifier/processor"
|
||||||
|
|
||||||
module Notifier
|
module Notifier
|
||||||
class << self
|
class << self
|
||||||
def process_all(configuration = nil)
|
def process_all(configuration = nil)
|
||||||
|
|
|
@ -43,3 +43,5 @@ append :linked_files,
|
||||||
|
|
||||||
# Uncomment the following to require manually verifying the host key before first deploy.
|
# Uncomment the following to require manually verifying the host key before first deploy.
|
||||||
# set :ssh_options, verify_host_key: :secure
|
# set :ssh_options, verify_host_key: :secure
|
||||||
|
|
||||||
|
set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
|
||||||
|
|
27
config/schedule.rb
Normal file
27
config/schedule.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Use this file to easily define all of your cron jobs.
|
||||||
|
#
|
||||||
|
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
||||||
|
# http://en.wikipedia.org/wiki/Cron
|
||||||
|
|
||||||
|
set :output, standard: "log/cron.log"
|
||||||
|
|
||||||
|
#
|
||||||
|
# every 2.hours do
|
||||||
|
# command "/usr/bin/some_great_command"
|
||||||
|
# runner "MyModel.some_method"
|
||||||
|
# rake "some:great:rake:task"
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# every 4.days do
|
||||||
|
# runner "AnotherModel.prune_old_records"
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Learn more: http://github.com/javan/whenever
|
||||||
|
|
||||||
|
every 1.day, at: '4:30 am', roles: [:app] do
|
||||||
|
rake "checks:sync_dates"
|
||||||
|
end
|
||||||
|
|
||||||
|
every 1.day, at: '10:30 am', roles: [:app] do
|
||||||
|
rake "notifications:send_all"
|
||||||
|
end
|
8
lib/tasks/notifications.rake
Normal file
8
lib/tasks/notifications.rake
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# require "services/notifier"
|
||||||
|
|
||||||
|
namespace :notifications do
|
||||||
|
desc "Send all notifications after checks have been performend"
|
||||||
|
task send_all: :environment do
|
||||||
|
Notifier.process_all
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue