sidekiq-unique-jobs 4.0.17 → 4.0.18
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq-unique-jobs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.dockerignore +4 -0
- data/.gitignore +1 -0
- data/.travis.yml +3 -3
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -0
- data/README.md +6 -3
- data/circle.yml +3 -6
- data/lib/sidekiq-unique-jobs.rb +4 -0
- data/lib/sidekiq_unique_jobs/cli.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +5 -1
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +3 -1
- data/lib/sidekiq_unique_jobs/script_mock.rb +68 -0
- data/lib/sidekiq_unique_jobs/scripts.rb +8 -5
- data/lib/sidekiq_unique_jobs/testing.rb +36 -0
- data/lib/sidekiq_unique_jobs/testing/sidekiq_overrides.rb +1 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/rails_example/.env +12 -0
- data/rails_example/.rspec +2 -0
- data/rails_example/Gemfile +21 -7
- data/rails_example/app/channels/appearance_channel.rb +17 -0
- data/rails_example/app/channels/application_cable/channel.rb +4 -0
- data/rails_example/app/channels/application_cable/connection.rb +9 -0
- data/rails_example/app/channels/post_channel.rb +5 -0
- data/rails_example/app/controllers/work_controller.rb +8 -5
- data/rails_example/app/models/application_record.rb +3 -0
- data/rails_example/app/models/guest.rb +21 -0
- data/rails_example/app/models/post.rb +1 -1
- data/rails_example/app/workers/simple_worker.rb +5 -4
- data/rails_example/bin/check_or_setup_db +57 -0
- data/rails_example/bin/docker-setup +20 -0
- data/rails_example/bin/rails +1 -1
- data/rails_example/bin/setup +15 -10
- data/rails_example/bin/update +29 -0
- data/rails_example/cable.ru +6 -0
- data/rails_example/common-services.yml +50 -0
- data/rails_example/config/application.rb +5 -4
- data/rails_example/config/boot.rb +1 -1
- data/rails_example/config/cable.yml +9 -0
- data/rails_example/config/database.docker.yml +12 -0
- data/rails_example/config/database.yml +15 -22
- data/rails_example/config/environment.rb +1 -1
- data/rails_example/config/environments/development.rb +24 -11
- data/rails_example/config/environments/production.rb +24 -17
- data/rails_example/config/environments/test.rb +6 -6
- data/rails_example/config/initializers/application_controller_renderer.rb +6 -0
- data/rails_example/config/initializers/backtrace_silencers.rb +3 -2
- data/rails_example/config/initializers/cookies_serializer.rb +2 -0
- data/rails_example/config/initializers/new_framework_defaults.rb +23 -0
- data/rails_example/config/initializers/session_store.rb +1 -1
- data/rails_example/config/initializers/sidekiq.rb +2 -2
- data/rails_example/config/initializers/wrap_parameters.rb +2 -2
- data/rails_example/config/puma.rb +38 -0
- data/rails_example/config/routes.rb +2 -1
- data/rails_example/config/secrets.yml +3 -3
- data/rails_example/config/spring.rb +6 -0
- data/rails_example/db/migrate/20160724111322_create_posts.rb +12 -0
- data/rails_example/db/schema.rb +8 -4
- data/rails_example/dev-entrypoint.sh +55 -0
- data/rails_example/dev.env +12 -0
- data/rails_example/docker-compose.yml +90 -0
- data/rails_example/docker/rails.Dockerfile +27 -0
- data/rails_example/spec/controllers/work_controller_spec.rb +172 -0
- data/rails_example/spec/factories/posts.rb +8 -0
- data/rails_example/spec/models/post_spec.rb +4 -0
- data/rails_example/spec/rails_helper.rb +21 -0
- data/rails_example/spec/spec_helper.rb +20 -0
- data/rails_example/spec/support/sidekiq_meta.rb +12 -0
- data/rails_example/spec/workers/simple_worker_spec.rb +4 -0
- data/spec/jobs/my_unique_job.rb +7 -2
- data/spec/jobs/my_unique_job_with_filter_method.rb +17 -0
- data/spec/jobs/my_unique_job_with_filter_proc.rb +15 -0
- data/spec/jobs/notify_worker.rb +1 -1
- data/spec/lib/sidekiq_unique_jobs/client/middleware_spec.rb +34 -0
- data/spec/lib/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb +5 -1
- data/spec/lib/sidekiq_unique_jobs/lock/until_executed_spec.rb +5 -8
- data/spec/lib/sidekiq_unique_jobs/options_with_fallback_spec.rb +2 -1
- data/spec/lib/sidekiq_unique_jobs/script_mock_spec.rb +84 -0
- data/spec/lib/sidekiq_unique_jobs/scripts_spec.rb +4 -0
- data/spec/lib/sidekiq_unique_jobs/sidekiq_testing_enabled_spec.rb +7 -11
- data/spec/lib/sidekiq_unique_jobs/sidekiq_unique_ext_spec.rb +2 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/support/sidekiq_meta.rb +16 -11
- metadata +39 -7
- data/rails_example/db/development.sqlite3 +0 -0
- data/rails_example/db/migrate/20151107231835_create_posts.rb +0 -10
- data/rails_example/db/test.sqlite3 +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
class Post <
|
1
|
+
class Post < ApplicationRecord
|
2
2
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
class SimpleWorker
|
2
2
|
include Sidekiq::Worker
|
3
3
|
sidekiq_options unique: :until_executed,
|
4
|
-
unique_args: -> (args) { [args.first] },
|
5
4
|
queue: :default,
|
6
|
-
|
5
|
+
unique_args: (lambda do |args|
|
6
|
+
[args.first]
|
7
|
+
end)
|
7
8
|
|
8
|
-
def perform(
|
9
|
-
sleep
|
9
|
+
def perform(_some_args)
|
10
|
+
sleep 1
|
10
11
|
end
|
11
12
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This script is used in the development environment with Docker to check if the
|
4
|
+
# app database exists, and runs the database setup if it doesn't, as it is the
|
5
|
+
# case when the project runs for the first time on the development machine.
|
6
|
+
#
|
7
|
+
# We are using this custom script instead of running the
|
8
|
+
# `rake db:version || rake db:setup` commands, as that currently leaves a
|
9
|
+
# couple of small ruby zombie processes running in the app container:
|
10
|
+
require 'rubygems'
|
11
|
+
require 'rake'
|
12
|
+
require 'bundler'
|
13
|
+
|
14
|
+
Bundler.setup(:default)
|
15
|
+
|
16
|
+
require 'active_record'
|
17
|
+
require 'pg'
|
18
|
+
|
19
|
+
exit begin
|
20
|
+
connection_tries ||= 3
|
21
|
+
ActiveRecord::Base.establish_connection && ActiveRecord::Migrator.current_version
|
22
|
+
0
|
23
|
+
rescue PG::ConnectionBad
|
24
|
+
unless (connection_tries -= 1).zero?
|
25
|
+
puts "Retrying DB connection #{connection_tries} more times..."
|
26
|
+
sleep ENV.fetch('APP_SETUP_WAIT', '5').to_i
|
27
|
+
retry
|
28
|
+
end
|
29
|
+
1
|
30
|
+
rescue ActiveRecord::NoDatabaseError, ActiveRecord::AdapterNotSpecified
|
31
|
+
|
32
|
+
include ActiveRecord::Tasks
|
33
|
+
|
34
|
+
DatabaseTasks.root = File.expand_path '../..', __FILE__
|
35
|
+
DatabaseTasks.db_dir = File.join DatabaseTasks.root, 'db'
|
36
|
+
DatabaseTasks.env = ENV.fetch 'ENV', ENV.fetch('RAILS_ENV', 'development')
|
37
|
+
|
38
|
+
# The App database seeder:
|
39
|
+
DatabaseTasks.seed_loader = (Class.new do
|
40
|
+
def load_seed
|
41
|
+
seed_file_path = File.join DatabaseTasks.db_dir, 'seeds.rb'
|
42
|
+
raise "Seed file '#{seed_file_path}' does not exist" unless File.file?(seed_file_path)
|
43
|
+
load seed_file_path
|
44
|
+
end
|
45
|
+
end).new
|
46
|
+
|
47
|
+
# Add model dirs to the autoload_paths for the seeder to run smoothly:
|
48
|
+
ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models', 'concerns')
|
49
|
+
ActiveSupport::Dependencies.autoload_paths << File.join(DatabaseTasks.root, 'app', 'models')
|
50
|
+
|
51
|
+
return 2 unless DatabaseTasks.create_current
|
52
|
+
return 3 unless DatabaseTasks.load_schema_current
|
53
|
+
return 4 unless DatabaseTasks.load_seed
|
54
|
+
0
|
55
|
+
ensure
|
56
|
+
ActiveRecord::Base.clear_all_connections!
|
57
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
# ln -s ../ gems/sidekiq-unique-jobs
|
6
|
+
cp -f config/database.docker.yml config/database.yml
|
7
|
+
# cp -f config/application.docker.yml config/application.yml
|
8
|
+
|
9
|
+
# build app image
|
10
|
+
docker-compose build
|
11
|
+
|
12
|
+
# start mysql and redis in background
|
13
|
+
docker-compose start postgres
|
14
|
+
docker-compose start redis
|
15
|
+
|
16
|
+
# setup database
|
17
|
+
docker-compose run web rake db:create db:migrate
|
18
|
+
|
19
|
+
# ensure all containers are up and running
|
20
|
+
docker-compose up
|
data/rails_example/bin/rails
CHANGED
data/rails_example/bin/setup
CHANGED
@@ -1,29 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
3
5
|
|
4
6
|
# path to your application root.
|
5
7
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
8
|
|
7
|
-
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
8
14
|
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file
|
15
|
+
# Add necessary setup steps to this file.
|
10
16
|
|
11
17
|
puts '== Installing dependencies =='
|
12
|
-
system 'gem install bundler --conservative'
|
13
|
-
system
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
14
20
|
|
15
21
|
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?(
|
17
|
-
#
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
18
24
|
# end
|
19
25
|
|
20
26
|
puts "\n== Preparing database =="
|
21
|
-
system 'bin/
|
27
|
+
system! 'bin/rails db:setup'
|
22
28
|
|
23
29
|
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system '
|
25
|
-
system 'rm -rf tmp/cache'
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
31
|
|
27
32
|
puts "\n== Restarting application server =="
|
28
|
-
system '
|
33
|
+
system! 'bin/rails restart'
|
29
34
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
version: '2'
|
2
|
+
services:
|
3
|
+
rails:
|
4
|
+
image: ruby:2.3
|
5
|
+
# build:
|
6
|
+
# context: .
|
7
|
+
# dockerfile: docker/rails.Dockerfile
|
8
|
+
# We'll specify a dotenv file for docker-compose to load more environment
|
9
|
+
# variables into our app containers. This dotenv file would normally contain
|
10
|
+
# sensitive data (API keys & secrets, etc) which SHOULD NOT be committed into
|
11
|
+
# Git.
|
12
|
+
# Keep in mind that any changes in this file will require a container restart
|
13
|
+
# in order to be available on the app containers:
|
14
|
+
env_file:
|
15
|
+
- dev.env
|
16
|
+
# Specify environment variables available for our app containers. We'll leave
|
17
|
+
# a YML anchor in case we need to override or add more variables if needed on
|
18
|
+
# each app container:
|
19
|
+
environment: &app_environment
|
20
|
+
# We'll overwrite the PATH environment variable to include the 'bin/'
|
21
|
+
# directory, for the entrypoint script to find the app's executables:
|
22
|
+
PATH: /usr/src/app/bin:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
23
|
+
|
24
|
+
# We'll set the REDIS_URL environment variable for the app to connect
|
25
|
+
# to our redis container:
|
26
|
+
REDIS_URL: redis://redis:6379
|
27
|
+
|
28
|
+
# We'll set the RAILS_ENV and RACK_ENV environment variables to
|
29
|
+
# 'development', so our app containers will start in 'development' mode
|
30
|
+
# on this compose project:
|
31
|
+
RAILS_ENV: development
|
32
|
+
RACK_ENV: development
|
33
|
+
cpu_shares: 4
|
34
|
+
# Specify the directory from where all commands sent to the container will be
|
35
|
+
# issued to where the code is mounted:
|
36
|
+
working_dir: /usr/src/app
|
37
|
+
|
38
|
+
# Keep the stdin open, so we can attach to our app container's process
|
39
|
+
# and do things such as byebug, etc:
|
40
|
+
stdin_open: true
|
41
|
+
|
42
|
+
# Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
|
43
|
+
tty: true
|
44
|
+
volumes:
|
45
|
+
# Mount our app code directory (".") into our app containers at the
|
46
|
+
# "/usr/src/app" folder:
|
47
|
+
- .:/usr/src/app
|
48
|
+
|
49
|
+
# Mount the 'gems' volume on the folder that stores bundled gems:
|
50
|
+
- gems:/usr/local/bundle
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
1
|
+
require_relative 'boot'
|
2
2
|
|
3
|
+
require 'bigdecimal'
|
4
|
+
require 'bigdecimal/util'
|
3
5
|
require 'rails/all'
|
4
6
|
|
5
7
|
# Require the gems listed in Gemfile, including any gems
|
@@ -14,13 +16,12 @@ module RailsExample
|
|
14
16
|
|
15
17
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
16
18
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
17
|
-
|
19
|
+
config.time_zone = 'CET'
|
18
20
|
|
19
21
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
20
22
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
21
23
|
# config.i18n.default_locale = :de
|
22
24
|
|
23
|
-
#
|
24
|
-
config.active_record.raise_in_transactional_callbacks = true
|
25
|
+
# config.active_record.schema_format = :sql
|
25
26
|
end
|
26
27
|
end
|
@@ -1,26 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
defaults: &defaults
|
2
|
+
encoding: unicode
|
3
|
+
adapter: postgresql
|
4
|
+
host: <%= ENV.fetch('DB_HOST') { 'localhost' } %>
|
5
|
+
port: <%= ENV.fetch('DB_PORT') { 5432 } %>
|
6
|
+
username: <%= ENV.fetch('DB_USERNAME') { 'postgres' } %>
|
7
|
+
password: <%= ENV.fetch('DB_PASSWORD') { '' } %>
|
8
|
+
pool: <%= ENV.fetch('DB_POOL') { 25 } %>
|
9
|
+
timeout: <%= ENV.fetch('DB_TIMEOUT') { 5000 } %>
|
10
|
+
reaping_frequency: <%= ENV.fetch('DB_REAPING_FREQUENCY') { 5000 } %>
|
11
|
+
|
6
12
|
development:
|
7
|
-
|
8
|
-
database:
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
13
|
+
<<: *defaults
|
14
|
+
database: rails_example_dev
|
11
15
|
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
16
|
test:
|
16
|
-
|
17
|
-
database:
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
17
|
+
<<: *defaults
|
18
|
+
database: rails_example_test
|
26
19
|
|
@@ -9,13 +9,28 @@ Rails.application.configure do
|
|
9
9
|
# Do not eager load code on boot.
|
10
10
|
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports
|
13
|
-
config.consider_all_requests_local
|
14
|
-
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
config.cache_store = :memory_store
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => 'public, max-age=172800'
|
22
|
+
}
|
23
|
+
else
|
24
|
+
config.action_controller.perform_caching = false
|
25
|
+
|
26
|
+
config.cache_store = :null_store
|
27
|
+
end
|
15
28
|
|
16
29
|
# Don't care if the mailer can't send.
|
17
30
|
config.action_mailer.raise_delivery_errors = false
|
18
31
|
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
19
34
|
# Print deprecation notices to the Rails logger.
|
20
35
|
config.active_support.deprecation = :log
|
21
36
|
|
@@ -27,15 +42,13 @@ Rails.application.configure do
|
|
27
42
|
# number of complex assets.
|
28
43
|
config.assets.debug = true
|
29
44
|
|
30
|
-
#
|
31
|
-
|
32
|
-
config.assets.digest = true
|
33
|
-
|
34
|
-
# Adds additional error checking when serving assets at runtime.
|
35
|
-
# Checks for improperly declared sprockets dependencies.
|
36
|
-
# Raises helpful error messages.
|
37
|
-
config.assets.raise_runtime_errors = true
|
45
|
+
# Suppress logger output for asset requests.
|
46
|
+
config.assets.quiet = true
|
38
47
|
|
39
48
|
# Raises error for missing translations
|
40
49
|
# config.action_view.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
41
54
|
end
|
@@ -14,15 +14,9 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
17
|
# Disable serving static files from the `/public` folder by default since
|
24
18
|
# Apache or NGINX already handles this.
|
25
|
-
config.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
20
|
|
27
21
|
# Compress JavaScripts and CSS.
|
28
22
|
config.assets.js_compressor = :uglifier
|
@@ -31,16 +25,20 @@ Rails.application.configure do
|
|
31
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
26
|
config.assets.compile = false
|
33
27
|
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
-
# yet still be able to expire them through the digest params.
|
36
|
-
config.assets.digest = true
|
37
|
-
|
38
28
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
29
|
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
40
33
|
# Specifies the header that your server uses for sending files.
|
41
34
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
35
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
36
|
|
37
|
+
# Mount Action Cable outside main process or domain
|
38
|
+
# config.action_cable.mount_path = nil
|
39
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
40
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
41
|
+
|
44
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
43
|
# config.force_ssl = true
|
46
44
|
|
@@ -49,16 +47,15 @@ Rails.application.configure do
|
|
49
47
|
config.log_level = :debug
|
50
48
|
|
51
49
|
# Prepend all log lines with the following tags.
|
52
|
-
|
53
|
-
|
54
|
-
# Use a different logger for distributed setups.
|
55
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
50
|
+
config.log_tags = [:request_id]
|
56
51
|
|
57
52
|
# Use a different cache store in production.
|
58
53
|
# config.cache_store = :mem_cache_store
|
59
54
|
|
60
|
-
#
|
61
|
-
# config.
|
55
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
56
|
+
# config.active_job.queue_adapter = :resque
|
57
|
+
# config.active_job.queue_name_prefix = "rails_example_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
62
59
|
|
63
60
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
61
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -74,6 +71,16 @@ Rails.application.configure do
|
|
74
71
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
72
|
config.log_formatter = ::Logger::Formatter.new
|
76
73
|
|
74
|
+
# Use a different logger for distributed setups.
|
75
|
+
# require 'syslog/logger'
|
76
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
+
|
78
|
+
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
79
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
+
logger.formatter = config.log_formatter
|
81
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
+
end
|
83
|
+
|
77
84
|
# Do not dump schema after migrations.
|
78
85
|
config.active_record.dump_schema_after_migration = false
|
79
86
|
end
|