Always catch StandardError in Threads and release connection
This commit is contained in:
@ -13,6 +13,8 @@ module ActionCableHelper
|
|||||||
locals: {request_for_comment: self})
|
locals: {request_for_comment: self})
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
Sentry.capture_exception(e)
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end
|
||||||
@ -33,6 +35,8 @@ module ActionCableHelper
|
|||||||
working_time_data: exercise.get_working_times_for_study_group(study_group_id, user)
|
working_time_data: exercise.get_working_times_for_study_group(study_group_id, user)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
Sentry.capture_exception(e)
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end
|
||||||
|
@ -312,6 +312,8 @@ class Submission < ApplicationRecord
|
|||||||
rfc.full_score_reached = true
|
rfc.full_score_reached = true
|
||||||
rfc.save
|
rfc.save
|
||||||
end
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
Sentry.capture_exception(e)
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end
|
||||||
|
@ -19,6 +19,8 @@ module Prometheus
|
|||||||
initialize_rfc_metrics
|
initialize_rfc_metrics
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
Sentry.capture_exception(e)
|
Sentry.capture_exception(e)
|
||||||
|
ensure
|
||||||
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,6 +32,8 @@ class Runner::EventLoop
|
|||||||
queue = Queue.new
|
queue = Queue.new
|
||||||
Thread.new do
|
Thread.new do
|
||||||
EventMachine.run { queue.push nil }
|
EventMachine.run { queue.push nil }
|
||||||
|
rescue StandardError => e
|
||||||
|
Sentry.capture_exception(e)
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user