mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
do not log Notifications#polling action anymore, by default, can be enable via env variable ENABLE_NOTIFICATIONS_POLLING_LOGGING=true
This commit is contained in:
parent
8c6da66538
commit
3ee63d4613
@ -5,6 +5,7 @@
|
||||
- Fix a bug: fix all failing tasks of rake task file chain.rake
|
||||
- Fix a bug: file_size_validator.rb was broken since ruby v3, see https://github.com/rails/rails/issues/41270
|
||||
- decreases sidekiq concurrency from 25 to 5, 25 is too much and consumes memory for nothing
|
||||
- do not log Notifications#polling action anymore, by default, can be enable via env variable ENABLE_NOTIFICATIONS_POLLING_LOGGING=true
|
||||
|
||||
## v6.2.0 2023 October 13
|
||||
|
||||
|
1
Gemfile
1
Gemfile
@ -153,3 +153,4 @@ gem 'sentry-ruby'
|
||||
gem "reverse_markdown"
|
||||
|
||||
gem "ancestry"
|
||||
gem 'silencer', require: false
|
@ -462,6 +462,7 @@ GEM
|
||||
concurrent-ruby (~> 1.0, >= 1.0.5)
|
||||
sidekiq (>= 5.0, < 8.0)
|
||||
thor (>= 0.20, < 3.0)
|
||||
silencer (2.0.0)
|
||||
simplecov (0.19.0)
|
||||
docile (~> 1.1)
|
||||
simplecov-html (~> 0.11)
|
||||
@ -611,6 +612,7 @@ DEPENDENCIES
|
||||
sidekiq (>= 6.0.7)
|
||||
sidekiq-scheduler
|
||||
sidekiq-unique-jobs (~> 7.1.23)
|
||||
silencer
|
||||
spring (~> 4)
|
||||
spring-watcher-listen (~> 2.1.0)
|
||||
stripe (= 5.29.0)
|
||||
|
@ -52,9 +52,9 @@ class API::NotificationsController < API::APIController
|
||||
|
||||
def polling
|
||||
@notifications = current_user.notifications
|
||||
.with_valid_notification_type
|
||||
.where('notifications.is_read = false AND notifications.created_at >= :date', date: params[:last_poll])
|
||||
.order('notifications.created_at DESC')
|
||||
.with_valid_notification_type
|
||||
.where('notifications.is_read = false AND notifications.created_at >= :date', date: params[:last_poll])
|
||||
.order('notifications.created_at DESC')
|
||||
@totals = {
|
||||
total: current_user.notifications.with_valid_notification_type.delivered_in_system(current_user).count,
|
||||
unread: current_user.notifications.with_valid_notification_type.delivered_in_system(current_user).where(is_read: false).count
|
||||
|
13
config/initializers/silencer.rb
Normal file
13
config/initializers/silencer.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require 'silencer/rails/logger'
|
||||
|
||||
silenced_actions = []
|
||||
silenced_actions << "/api/notifications/polling" unless Rails.application.secrets.enable_notifications_polling_logging
|
||||
|
||||
Rails.application.configure do
|
||||
config.middleware.swap(
|
||||
Rails::Rack::Logger,
|
||||
Silencer::Logger,
|
||||
config.log_tags,
|
||||
silence: silenced_actions
|
||||
)
|
||||
end
|
@ -43,6 +43,7 @@ development:
|
||||
adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
|
||||
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
|
||||
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
|
||||
enable_notifications_polling_logging: <%= ENV.fetch("ENABLE_NOTIFICATIONS_POLLING_LOGGING", false) %>
|
||||
|
||||
test:
|
||||
secret_key_base: 83daf5e7b80d990f037407bab78dff9904aaf3c195a50f84fa8695a22287e707dfbd9524b403b1dcf116ae1d8c06844c3d7ed942564e5b46be6ae3ead93a9d30
|
||||
@ -75,6 +76,7 @@ test:
|
||||
adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
|
||||
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
|
||||
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
|
||||
enable_notifications_polling_logging: <%= ENV.fetch("ENABLE_NOTIFICATIONS_POLLING_LOGGING", false) %>
|
||||
|
||||
staging:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
@ -117,6 +119,7 @@ staging:
|
||||
enable_in_context_translation: <%= ENV["ENABLE_IN_CONTEXT_TRANSLATION"] %>
|
||||
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
|
||||
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
|
||||
enable_notifications_polling_logging: <%= ENV.fetch("ENABLE_NOTIFICATIONS_POLLING_LOGGING", false) %>
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
@ -162,3 +165,4 @@ production:
|
||||
adminsys_email: <%= ENV["ADMINSYS_EMAIL"] %>
|
||||
allow_insecure_http: <%= ENV.fetch("ALLOW_INSECURE_HTTP", false) %>
|
||||
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>
|
||||
enable_notifications_polling_logging: <%= ENV.fetch("ENABLE_NOTIFICATIONS_POLLING_LOGGING", false) %>
|
||||
|
Loading…
Reference in New Issue
Block a user