From 5fc9a88dfad0c7e9d859ea1c2629a1da3d1a2d8f Mon Sep 17 00:00:00 2001 From: Misha Merkushin Date: Tue, 15 Nov 2022 16:31:58 +0300 Subject: [PATCH 1/2] fix: don't panic in on_error callback --- exe/schked | 2 +- lib/schked/worker.rb | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/exe/schked b/exe/schked index 3756d26..54c298f 100755 --- a/exe/schked +++ b/exe/schked @@ -1,4 +1,4 @@ -#!/usr/bun/ruby +#!/usr/bin/ruby # frozen_string_literal: true require "bundler/setup" diff --git a/lib/schked/worker.rb b/lib/schked/worker.rb index c44fc19..5d846a0 100644 --- a/lib/schked/worker.rb +++ b/lib/schked/worker.rb @@ -47,7 +47,12 @@ def define_callbacks cfg = config scheduler.define_singleton_method(:on_error) do |job, error| - cfg.logger.fatal("Task #{job.opts[:as] || job.job_id} failed with error: #{error.message}") + name = if job + job.opts[:as] || job.job_id + else + "unknown" + end + cfg.logger.fatal("Task #{name} failed with error: #{error.message}") cfg.logger.error(error.backtrace.join("\n")) if error.backtrace cfg.fire_callback(:on_error, job, error) From 9d9755214ceee03de8382e90aee2855cdd2e933d Mon Sep 17 00:00:00 2001 From: Misha Merkushin Date: Tue, 15 Nov 2022 16:32:13 +0300 Subject: [PATCH 2/2] bump version --- lib/schked/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/schked/version.rb b/lib/schked/version.rb index 451e571..330abbb 100644 --- a/lib/schked/version.rb +++ b/lib/schked/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Schked - VERSION = "1.1.0" + VERSION = "1.1.1" end