lib/zendesk.rb in killbill-zendesk-2.0.0 vs lib/zendesk.rb in killbill-zendesk-3.0.0
- old
+ new
@@ -20,13 +20,17 @@
@updater = Killbill::Zendesk::UserUpdaterInitializer.instance.initialize!(@conf_dir, @kb_apis, @logger)
end
def after_request
# return DB connections to the Pool if required
- ActiveRecord::Base.connection.close
+ ::ActiveRecord::Base.connection.close if ::ActiveRecord::Base.connection_pool.active_connection?
end
def on_event(event)
+ if @updater.nil?
+ logger.warn "ZendeskPlugin wasn't started properly - check logs"
+ return
+ end
@updater.update(event.account_id) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
end
end
end