mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 02:52:49 +01:00
Run scheduler in a separate process
This commit is contained in:
parent
0874b54375
commit
a0a16684a6
@ -2,6 +2,5 @@
|
|||||||
|
|
||||||
require './config/environment'
|
require './config/environment'
|
||||||
require 'api'
|
require 'api'
|
||||||
require 'schedule'
|
|
||||||
|
|
||||||
run Sinatra::Application
|
run Sinatra::Application
|
||||||
|
@ -9,3 +9,8 @@ timeout 10
|
|||||||
before_fork do |_, _|
|
before_fork do |_, _|
|
||||||
Sequel::DATABASES.each(&:disconnect)
|
Sequel::DATABASES.each(&:disconnect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fork do
|
||||||
|
require_relative 'environment'
|
||||||
|
require 'schedule'
|
||||||
|
end
|
||||||
|
@ -8,3 +8,5 @@ schedule = Rufus::Scheduler.new
|
|||||||
schedule.cron '*/15 15,16,17 * * 1-5' do
|
schedule.cron '*/15 15,16,17 * * 1-5' do
|
||||||
Bank.fetch_current_rates!
|
Bank.fetch_current_rates!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
schedule.join
|
||||||
|
Loading…
Reference in New Issue
Block a user