From ccb28d8305750801b412e25d33e2ad70a7b169f2 Mon Sep 17 00:00:00 2001 From: Rodrigo Borba Date: Sun, 25 Jan 2026 12:23:12 -0300 Subject: [PATCH] =?UTF-8?q?refactor:=20Ajusta=20o=20namespace=20de=20`Inbo?= =?UTF-8?q?xAutomation`,=20refina=20os=20caminhos=20de=20eager=20loading?= =?UTF-8?q?=20da=20aplica=C3=A7=C3=A3o=20enterprise=20e=20melhora=20a=20ro?= =?UTF-8?q?bustez=20do=20status=20da=20inst=C3=A2ncia=20com=20verifica?= =?UTF-8?q?=C3=A7=C3=A3o=20de=20`connection=5Fpool`=20e=20tratamento=20de?= =?UTF-8?q?=20erro=20Redis=20mais=20abrangente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../super_admin/instance_statuses_controller.rb | 10 ++++++++-- app/models/inbox.rb | 2 +- config/application.rb | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/super_admin/instance_statuses_controller.rb b/app/controllers/super_admin/instance_statuses_controller.rb index d809f91..fcecb1c 100755 --- a/app/controllers/super_admin/instance_statuses_controller.rb +++ b/app/controllers/super_admin/instance_statuses_controller.rb @@ -20,7 +20,12 @@ class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController end def instance_meta - @metrics['Database Migrations'] = ActiveRecord::Base.connection_pool.migration_context.needs_migration? ? 'pending' : 'completed' + context = if ActiveRecord::Base.respond_to?(:connection_pool) + ActiveRecord::Base.connection_pool.migration_context + else + ActiveRecord::Base.connection.migration_context + end + @metrics['Database Migrations'] = context.needs_migration? ? 'pending' : 'completed' end def chatwoot_version @@ -53,7 +58,8 @@ class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController @metrics["Redis 'maxmemory' setting"] = redis_server['maxmemory'] @metrics["Redis 'maxmemory_policy' setting"] = redis_server['maxmemory_policy'] end - rescue Redis::CannotConnectError + rescue StandardError => e + Rails.logger.warn "Redis status check failed: #{e.message}" @metrics['Redis alive'] = false end end diff --git a/app/models/inbox.rb b/app/models/inbox.rb index 69b2302..bcef42a 100755 --- a/app/models/inbox.rb +++ b/app/models/inbox.rb @@ -77,7 +77,7 @@ class Inbox < ApplicationRecord has_one :agent_bot, through: :agent_bot_inbox has_many :webhooks, dependent: :destroy_async has_many :hooks, dependent: :destroy_async, class_name: 'Integrations::Hook' - has_many :inbox_automations, dependent: :destroy_async, class_name: 'Captain::InboxAutomation' + has_many :inbox_automations, dependent: :destroy_async, class_name: '::Captain::InboxAutomation' # Jasmine has_one :jasmine_inbox_config, class_name: 'Jasmine::InboxConfig', dependent: :destroy diff --git a/config/application.rb b/config/application.rb index 3b4f4ca..2593ec4 100755 --- a/config/application.rb +++ b/config/application.rb @@ -42,7 +42,8 @@ module Chatwoot config.eager_load_paths << Rails.root.join('enterprise/lib') config.eager_load_paths << Rails.root.join('enterprise/listeners') # rubocop:disable Rails/FilePath - config.eager_load_paths += Dir["#{Rails.root}/enterprise/app/*"] + enterprise_app_paths = Dir["#{Rails.root}/enterprise/app/*"].reject { |path| %w[views javascript assets].include?(File.basename(path)) } + config.eager_load_paths += enterprise_app_paths # rubocop:enable Rails/FilePath # Add enterprise views to the view paths config.paths['app/views'].unshift('enterprise/app/views')