Skip to content

Commit

Permalink
Merge pull request #137 from abak-press/master
Browse files Browse the repository at this point in the history
Merge retry-unique...master
  • Loading branch information
bibendi authored Mar 16, 2018
2 parents 1b17018 + b506637 commit 5f51d7b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 10 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion dip.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/resque/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 8 additions & 0 deletions lib/resque/integration/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions lib/resque/integration/monkey_patch/verbose_formatter.rb
Original file line number Diff line number Diff line change
@@ -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
8 changes: 3 additions & 5 deletions lib/resque/integration/tasks/hooks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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 сигнал для ротации логов
Expand Down Expand Up @@ -39,11 +42,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
Expand Down
2 changes: 1 addition & 1 deletion lib/resque/integration/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Resque
module Integration
VERSION = '2.0.0'.freeze
VERSION = '3.0.0'.freeze
end
end
4 changes: 2 additions & 2 deletions resque-integration.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'

Expand Down

0 comments on commit 5f51d7b

Please sign in to comment.