From de070d5bfa11e9190f178d0861314f887a70ae72 Mon Sep 17 00:00:00 2001 From: Dzmitry Plashchynski Date: Fri, 24 Jun 2016 13:33:57 +0300 Subject: [PATCH] Fix job saving --- lib/crono/cli.rb | 2 ++ lib/crono/job.rb | 2 +- .../crono/install/templates/migrations/create_crono_jobs.rb | 1 - spec/job_spec.rb | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/crono/cli.rb b/lib/crono/cli.rb index 5bf55b3..a06a18e 100644 --- a/lib/crono/cli.rb +++ b/lib/crono/cli.rb @@ -1,3 +1,5 @@ +Thread.abort_on_exception = true + require 'crono' require 'optparse' diff --git a/lib/crono/job.rb b/lib/crono/job.rb index 909e045..1535351 100644 --- a/lib/crono/job.rb +++ b/lib/crono/job.rb @@ -65,7 +65,7 @@ module Crono saved_log = model.reload.log || '' log_to_save = saved_log + job_log.string model.update(last_performed_at: last_performed_at, log: log_to_save, - healthy: healthy, args: job_args) + healthy: healthy) end def perform_job diff --git a/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb b/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb index 3c8c26e..b7d9543 100644 --- a/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb +++ b/lib/generators/crono/install/templates/migrations/create_crono_jobs.rb @@ -5,7 +5,6 @@ class CreateCronoJobs < ActiveRecord::Migration t.text :log t.datetime :last_performed_at t.boolean :healthy - t.text :args t.timestamps null: false end add_index :crono_jobs, [:job_id], unique: true diff --git a/spec/job_spec.rb b/spec/job_spec.rb index 5e4c63b..3ab219a 100644 --- a/spec/job_spec.rb +++ b/spec/job_spec.rb @@ -105,7 +105,6 @@ describe Crono::Job do @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.healthy).to be true - expect(@crono_job.args).to eq '[{"some":"data"}]' end it 'should save and truncate job log' do