diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 421313aa..e8746357 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,8 +10,9 @@ class ApplicationController < ActionController::Base around_action :with_locale # before_action :sign_in_for_demo, if: -> { Docuseal.demo? } - before_action :maybe_authenticate_via_token - before_action :authenticate_via_token!, unless: :devise_controller? + before_action :maybe_redirect_to_setup, unless: :signed_in? + before_action :authenticate_user!, unless: :devise_controller? + # before_action :newrelic_metadata helper_method :button_title, :current_account, @@ -157,4 +158,11 @@ class ApplicationController < ActionController::Base redirect_to request.url.gsub('.co/', '.com/'), allow_other_host: true, status: :moved_permanently end + + # Add to this as required! + # def newrelic_metadata + # ::NewRelic::Agent.add_custom_attributes( + # user_id: current_user&.id + # ) + # end end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 093e80b6..d10c0717 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,5 +1,19 @@ # frozen_string_literal: true class ApplicationJob < ActiveJob::Base + # include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation + retry_on StandardError, wait: 6.seconds, attempts: 5 unless Docuseal.multitenant? + # unique :while_executing, on_conflict: :log + + # def perform(*args) + # receiver_str, _, message = args.shift.rpartition('.') + # time = Benchmark.measure do + # receiver_str.constantize.send(message, *args) + # end + # Rails.logger.info( + # "Finished #{receiver_str}.#{message}(#{args.map(&:to_s).join(', ')}): #{time}" + # ) + # end + # add_transaction_tracer :perform, category: :task end diff --git a/config/newrelic.yml b/config/newrelic.yml index 05b6041c..44ae7d8e 100644 --- a/config/newrelic.yml +++ b/config/newrelic.yml @@ -1114,4 +1114,4 @@ production: <<: *default_settings app_name: <%= ENV['NEWRELIC_APP_NAME'] %> Production monitor_mode: <%= ENV['NEWRELIC_MONITOR_MODE'].presence || true %> - distributed_tracing.enabled: false \ No newline at end of file + distributed_tracing.enabled: false