8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/jobs/ocpp/rails/session_async_hook_job.rb', line 8
def perform(charging_session_id, event, hook_class_name)
charging_session = Ocpp::Rails::ChargingSession.find_by(id: charging_session_id)
unless charging_session
::Rails.logger.warn("ChargingSession #{charging_session_id} not found, may have been cleaned up")
return
end
hook_class = hook_class_name.constantize
hook = hook_class.new
hook.call(charging_session, event)
rescue => error
::Rails.logger.error("SessionAsyncHook #{hook_class_name} failed for ChargingSession #{charging_session_id} (#{event}): #{error.message}")
raise
end
|