diff --git a/Gemfile.lock b/Gemfile.lock index 5187757f..e0e1fa0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,50 +15,50 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.1.0) - actionpack (= 7.1.0) - activesupport (= 7.1.0) + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.0) - actionpack (= 7.1.0) - activejob (= 7.1.0) - activerecord (= 7.1.0) - activestorage (= 7.1.0) - activesupport (= 7.1.0) + actionmailbox (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.0) - actionpack (= 7.1.0) - actionview (= 7.1.0) - activejob (= 7.1.0) - activesupport (= 7.1.0) + actionmailer (7.1.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.0) - actionview (= 7.1.0) - activesupport (= 7.1.0) + actionpack (7.1.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.0) - actionpack (= 7.1.0) - activerecord (= 7.1.0) - activestorage (= 7.1.0) - activesupport (= 7.1.0) + actiontext (7.1.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.0) - activesupport (= 7.1.0) + actionview (7.1.1) + activesupport (= 7.1.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -66,22 +66,22 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (7.1.0) - activesupport (= 7.1.0) + activejob (7.1.1) + activesupport (= 7.1.1) globalid (>= 0.3.6) - activemodel (7.1.0) - activesupport (= 7.1.0) - activerecord (7.1.0) - activemodel (= 7.1.0) - activesupport (= 7.1.0) + activemodel (7.1.1) + activesupport (= 7.1.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) timeout (>= 0.4.0) - activestorage (7.1.0) - actionpack (= 7.1.0) - activejob (= 7.1.0) - activerecord (= 7.1.0) - activesupport (= 7.1.0) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) marcel (~> 1.0) - activesupport (7.1.0) + activesupport (7.1.1) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -98,7 +98,7 @@ GEM rake (>= 10.4, < 14.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.834.0) + aws-partitions (1.837.0) aws-sdk-core (3.185.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) @@ -136,7 +136,7 @@ GEM debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) - devise (4.9.2) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -194,7 +194,7 @@ GEM actionpack (>= 6.0.0) railties (>= 6.0.0) io-console (0.6.0) - irb (1.8.1) + irb (1.8.3) rdoc reline (>= 0.3.8) jmespath (1.6.2) @@ -213,7 +213,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) lumberjack (1.2.9) @@ -235,7 +235,7 @@ GEM multi_xml (0.6.0) mutex_m (0.1.2) nenv (0.3.0) - net-imap (0.4.0) + net-imap (0.4.1) date net-protocol net-pop (0.1.2) @@ -294,7 +294,7 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.0) + psych (5.1.1.1) stringio public_suffix (5.0.3) puma (6.4.0) @@ -313,20 +313,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.0) - actioncable (= 7.1.0) - actionmailbox (= 7.1.0) - actionmailer (= 7.1.0) - actionpack (= 7.1.0) - actiontext (= 7.1.0) - actionview (= 7.1.0) - activejob (= 7.1.0) - activemodel (= 7.1.0) - activerecord (= 7.1.0) - activestorage (= 7.1.0) - activesupport (= 7.1.0) + rails (7.1.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) bundler (>= 1.15.0) - railties (= 7.1.0) + railties (= 7.1.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -334,9 +334,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.0) - actionpack (= 7.1.0) - activesupport (= 7.1.0) + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -353,10 +353,10 @@ GEM redis-client (>= 0.9.0) redis-client (0.17.0) connection_pool - regexp_parser (2.8.1) + regexp_parser (2.8.2) reline (0.3.9) io-console (~> 0.5) - responders (3.1.0) + responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rest-client (2.1.0) @@ -394,7 +394,7 @@ GEM rufus-scheduler (3.9.1) fugit (~> 1.1, >= 1.1.6) shellany (0.0.1) - sidekiq (7.1.5) + sidekiq (7.1.6) concurrent-ruby (< 2) connection_pool (>= 2.3.0) rack (>= 2.2.4) @@ -410,38 +410,38 @@ GEM hashie version_gem (~> 1.1, >= 1.1.1) stackprof (0.2.25) - standard (1.31.1) + standard (1.31.2) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.56.2) + rubocop (~> 1.56.4) standard-custom (~> 1.0.0) standard-performance (~> 1.2) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.2.0) + standard-performance (1.2.1) lint_roller (~> 1.1) - rubocop-performance (~> 1.19.0) + rubocop-performance (~> 1.19.1) standard-rails (0.2.0) lint_roller (~> 1.0) rubocop-rails (~> 2.20.2) - stimulus-rails (1.2.2) + stimulus-rails (1.3.0) railties (>= 6.0.0) stringio (3.0.8) - stripe (9.4.0) - tailwindcss-rails (2.0.30-aarch64-linux) + stripe (10.0.0) + tailwindcss-rails (2.0.31-aarch64-linux) railties (>= 6.0.0) - tailwindcss-rails (2.0.30-arm64-darwin) + tailwindcss-rails (2.0.31-arm64-darwin) railties (>= 6.0.0) - tailwindcss-rails (2.0.30-x86_64-darwin) + tailwindcss-rails (2.0.31-x86_64-darwin) railties (>= 6.0.0) - tailwindcss-rails (2.0.30-x86_64-linux) + tailwindcss-rails (2.0.31-x86_64-linux) railties (>= 6.0.0) temple (0.10.3) thor (1.2.2) tilt (2.3.0) timeout (0.4.0) - turbo-rails (1.4.0) + turbo-rails (1.5.0) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) diff --git a/config/database.yml b/config/database.yml index 5a02f59b..ed8d058b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -19,7 +19,11 @@ default: &default encoding: unicode # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } + (Rails.configuration.active_record.global_executor_concurrency || 4) %> + # Do not forget to set DB connections with the formula: + # max_connections = web_processes * number_of_threads_per_web_process + web_processes * global_executor_concurrency + background_processes * number_of_threads_per_background_process + background_processes * global_executor_concurrency + # For example, if you have 4 web processes, 1 sidekiq, 5 threads per web process, 5 threads per background process, and 4 global executors, then: + # max_connections = 4 * 5 + 4 * 4 + 1 * 5 + 1 * 4 = 49 development: <<: *default @@ -33,60 +37,10 @@ development: database: decent_visualizer_development <% end %> - # The specified database role being used to connect to postgres. - # To create additional roles in postgres see `$ createuser --help`. - # When left blank, postgres will use the default role. This is - # the same name as the operating system user running Rails. - #username: decent_visualizer - - # The password associated with the postgres role (username). - #password: - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - - # The TCP port the server listens on. Defaults to 5432. - # If your server runs on a different port number, change accordingly. - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # Defaults to warning. - #min_messages: notice - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: <<: *default database: decent_visualizer_test -# As with config/credentials.yml, you never want to store sensitive information, -# like your database password, in your source code. If your source code is -# ever seen by anyone, they now have access to your database. -# -# Instead, provide the password or a full connection URL as an environment -# variable when you boot the app. For example: -# -# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" -# -# If the connection URL is provided in the special DATABASE_URL environment -# variable, Rails will automatically merge its configuration values on top of -# the values provided in this file. Alternatively, you can specify a connection -# URL environment variable explicitly: -# -# production: -# url: <%= ENV["MY_APP_DATABASE_URL"] %> -# -# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database -# for a full overview on how database connection configuration can be specified. -# production: <<: *default url: <%= ENV["DATABASE_URL"] %> diff --git a/config/environments/development.rb b/config/environments/development.rb index 1904627f..96e54bd1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -63,6 +63,8 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true + config.active_record.async_query_executor = :global_thread_pool + # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true diff --git a/config/environments/production.rb b/config/environments/production.rb index f9e8132d..9c656e7d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -100,6 +100,8 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + config.active_record.async_query_executor = :global_thread_pool + # Enable DNS rebinding protection and other `Host` header attacks. # config.hosts = [ # "example.com", # Allow requests from example.com