From 27b7b31e6a8200db320857ed63fbb0faff67f5c3 Mon Sep 17 00:00:00 2001 From: Dmitry Bochkarev Date: Mon, 22 Jan 2018 14:25:20 +0500 Subject: [PATCH 1/4] =?UTF-8?q?feature:=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20resque,=20resque-scheduler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://jira.railsc.ru/browse/PC4-21241 resque-scheduler требует версию resque >= 1.26 --- dip.yml | 2 +- lib/resque/integration/engine.rb | 8 ++++++++ lib/resque/integration/tasks/hooks.rake | 5 ----- resque-integration.gemspec | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dip.yml b/dip.yml index 87e1447..c981e91 100644 --- a/dip.yml +++ b/dip.yml @@ -1,7 +1,7 @@ version: '1' environment: - DOCKER_RUBY_VERSION: 2.2 + DOCKER_RUBY_VERSION: '2.2' RUBY_IMAGE_TAG: 2.2-latest COMPOSE_FILE_EXT: development RAILS_ENV: test diff --git a/lib/resque/integration/engine.rb b/lib/resque/integration/engine.rb index 565f20b..778b1bb 100644 --- a/lib/resque/integration/engine.rb +++ b/lib/resque/integration/engine.rb @@ -22,6 +22,14 @@ class Engine < Rails::Engine Resque.config = Resque::Integration::Configuration.new(*paths.map(&:to_s)) end + # Читает конфиг-файл config/resque_schedule.yml + initializer 'resque-integration.schedule_config' do + if Resque.config.resque_scheduler? && Resque.config.schedule_exists? + config = ERB.new(File.read(Resque.config.schedule_file)).result + Resque.schedule = YAML.load(config) + end + end + # Устанавливает для Resque соединение с Редисом, # данные берутся из конфига (см. выше) initializer 'resque-integration.redis' do diff --git a/lib/resque/integration/tasks/hooks.rake b/lib/resque/integration/tasks/hooks.rake index bfe619c..5716caf 100644 --- a/lib/resque/integration/tasks/hooks.rake +++ b/lib/resque/integration/tasks/hooks.rake @@ -39,11 +39,6 @@ namespace :resque do # Support for resque-multi-job-forks require 'resque-multi-job-forks' if ENV['JOBS_PER_FORK'] || ENV['MINUTES_PER_FORK'] - if Resque.config.resque_scheduler? && Resque.config.schedule_exists? - config = ERB.new(File.read(Resque.config.schedule_file)).result - Resque.schedule = YAML.load(config) - end - if Resque.config.run_at_exit_hooks? && ENV['RUN_AT_EXIT_HOOKS'].nil? ENV['RUN_AT_EXIT_HOOKS'] = '1' end diff --git a/resque-integration.gemspec b/resque-integration.gemspec index 3029ca4..9e9440f 100644 --- a/resque-integration.gemspec +++ b/resque-integration.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |gem| gem.metadata['allowed_push_host'] = 'https://gems.railsc.ru' - gem.add_runtime_dependency 'resque', '= 1.25.2' + gem.add_runtime_dependency 'resque', '>= 1.25.2' gem.add_runtime_dependency 'railties', '>= 3.0.0', '< 5' gem.add_runtime_dependency 'activerecord', '>= 3.0.0', '< 5' gem.add_runtime_dependency 'actionpack', '>= 3.0.0', '< 5' @@ -26,7 +26,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'resque-progress', '~> 1.0.1' gem.add_runtime_dependency 'resque-multi-job-forks', '~> 0.4.2' gem.add_runtime_dependency 'resque-failed-job-mailer', '~> 0.0.3' - gem.add_runtime_dependency 'resque-scheduler', '~> 4.0', '< 4.2.1' + gem.add_runtime_dependency 'resque-scheduler', '~> 4.0' gem.add_runtime_dependency 'resque-retry', '~> 1.5' gem.add_runtime_dependency 'god', '~> 0.13.4' From 927f57ee0fc638d856ff5d655df52cde54807881 Mon Sep 17 00:00:00 2001 From: Dmitry Bochkarev Date: Thu, 25 Jan 2018 08:13:10 +0500 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=D0=B2=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=B4=D0=B6=D0=BE=D0=B1?= =?UTF-8?q?=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://jira.railsc.ru/browse/PC4-21241 https://github.com/abak-press/pulscen/pull/16402#issuecomment-360086865 --- lib/resque/integration.rb | 1 + .../integration/monkey_patch/verbose_formatter.rb | 10 ++++++++++ lib/resque/integration/tasks/hooks.rake | 3 +++ 3 files changed, 14 insertions(+) create mode 100644 lib/resque/integration/monkey_patch/verbose_formatter.rb diff --git a/lib/resque/integration.rb b/lib/resque/integration.rb index e17b958..ccd94a6 100644 --- a/lib/resque/integration.rb +++ b/lib/resque/integration.rb @@ -11,6 +11,7 @@ require 'resque' silence_warnings { require 'resque/plugins/meta' } +require 'resque/integration/monkey_patch/verbose_formatter' require 'resque/integration/hooks' require 'resque/scheduler' diff --git a/lib/resque/integration/monkey_patch/verbose_formatter.rb b/lib/resque/integration/monkey_patch/verbose_formatter.rb new file mode 100644 index 0000000..b95e550 --- /dev/null +++ b/lib/resque/integration/monkey_patch/verbose_formatter.rb @@ -0,0 +1,10 @@ +require "resque/log_formatters/verbose_formatter" + +module Resque + class VerboseFormatter + def call(serverity, datetime, progname, msg) + time = Time.now.strftime('%H:%M:%S %Y-%m-%d') + "** [#{time}] #$$: #{msg}\n" + end + end +end diff --git a/lib/resque/integration/tasks/hooks.rake b/lib/resque/integration/tasks/hooks.rake index 5716caf..129fcd0 100644 --- a/lib/resque/integration/tasks/hooks.rake +++ b/lib/resque/integration/tasks/hooks.rake @@ -10,6 +10,9 @@ namespace :resque do # (rails 3 не делают этого при запуске из rake-задачи) Rails.application.eager_load! if Rails::VERSION::MAJOR < 4 + # Включаем логирование в resque + ENV['VERBOSE'] = '1' + # перенаправление вывода в файл Resque::Integration::LogsRotator.redirect_std # слушать HUP сигнал для ротации логов From e57b3bdfcf6f49aacdf387edaf3dcab6cca9b1c8 Mon Sep 17 00:00:00 2001 From: Michail Merkushin Date: Fri, 16 Mar 2018 10:20:50 +0500 Subject: [PATCH 3/4] Release 3.0.0 --- lib/resque/integration/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resque/integration/version.rb b/lib/resque/integration/version.rb index 544f487..be07ce7 100644 --- a/lib/resque/integration/version.rb +++ b/lib/resque/integration/version.rb @@ -1,5 +1,5 @@ module Resque module Integration - VERSION = '2.0.0'.freeze + VERSION = '3.0.0'.freeze end end From b506637613a219d9369bb147bc975cb6299fe8f2 Mon Sep 17 00:00:00 2001 From: Automated Release Date: Fri, 16 Mar 2018 10:30:09 +0500 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7652380..357c3ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,14 @@ -# v2.0.0 +# v3.0.0 + +* 2018-03-16 [e57b3bd](../../commit/e57b3bd) - __(Michail Merkushin)__ Release 3.0.0 +* 2018-01-25 [927f57e](../../commit/927f57e) - __(Dmitry Bochkarev)__ fix: включение логирования в джобах +https://jira.railsc.ru/browse/PC4-21241 +https://github.com/abak-press/pulscen/pull/16402#issuecomment-360086865 + +* 2018-01-22 [27b7b31](../../commit/27b7b31) - __(Dmitry Bochkarev)__ feature: обновление resque, resque-scheduler +https://jira.railsc.ru/browse/PC4-21241 + +resque-scheduler требует версию resque >= 1.26 * 2017-12-21 [1073796](../../commit/1073796) - __(Dmitry Bochkarev)__ Release 2.0.0 https://github.com/abak-press/pulscen/releases/tag/20171220