mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-24 09:48:39 +02:00
Fix job saving
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
Thread.abort_on_exception = true
|
||||||
|
|
||||||
require 'crono'
|
require 'crono'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ module Crono
|
|||||||
saved_log = model.reload.log || ''
|
saved_log = model.reload.log || ''
|
||||||
log_to_save = saved_log + job_log.string
|
log_to_save = saved_log + job_log.string
|
||||||
model.update(last_performed_at: last_performed_at, log: log_to_save,
|
model.update(last_performed_at: last_performed_at, log: log_to_save,
|
||||||
healthy: healthy, args: job_args)
|
healthy: healthy)
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_job
|
def perform_job
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ class CreateCronoJobs < ActiveRecord::Migration
|
|||||||
t.text :log
|
t.text :log
|
||||||
t.datetime :last_performed_at
|
t.datetime :last_performed_at
|
||||||
t.boolean :healthy
|
t.boolean :healthy
|
||||||
t.text :args
|
|
||||||
t.timestamps null: false
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
add_index :crono_jobs, [:job_id], unique: true
|
add_index :crono_jobs, [:job_id], unique: true
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ describe Crono::Job do
|
|||||||
@crono_job = Crono::CronoJob.find_by(job_id: job.job_id)
|
@crono_job = Crono::CronoJob.find_by(job_id: job.job_id)
|
||||||
expect(@crono_job.last_performed_at.utc.to_s).to be_eql job.last_performed_at.utc.to_s
|
expect(@crono_job.last_performed_at.utc.to_s).to be_eql job.last_performed_at.utc.to_s
|
||||||
expect(@crono_job.healthy).to be true
|
expect(@crono_job.healthy).to be true
|
||||||
expect(@crono_job.args).to eq '[{"some":"data"}]'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should save and truncate job log' do
|
it 'should save and truncate job log' do
|
||||||
|
|||||||
Reference in New Issue
Block a user