mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-21 18:42:29 +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 'api'
|
||||
require 'schedule'
|
||||
|
||||
run Sinatra::Application
|
||||
|
@ -9,3 +9,8 @@ timeout 10
|
||||
before_fork do |_, _|
|
||||
Sequel::DATABASES.each(&:disconnect)
|
||||
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
|
||||
Bank.fetch_current_rates!
|
||||
end
|
||||
|
||||
schedule.join
|
||||
|
Loading…
Reference in New Issue
Block a user