DEV: Warn if distributed-mutexing in a request
This commit is contained in:
parent
5afdf24292
commit
ab0cefe54a
@ -29,6 +29,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
before_action :set_thread_variable
|
||||
before_action :rate_limit_crawlers
|
||||
before_action :check_readonly_mode
|
||||
before_action :handle_theme
|
||||
@ -56,6 +57,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
layout :set_layout
|
||||
|
||||
def set_thread_variable
|
||||
Thread.current["_in_request"] = true
|
||||
end
|
||||
|
||||
def has_escaped_fragment?
|
||||
SiteSetting.enable_escaped_fragments? && params.key?("_escaped_fragment_")
|
||||
end
|
||||
|
||||
@ -48,6 +48,7 @@ class DistributedMutex
|
||||
|
||||
# NOTE wrapped in mutex to maintain its semantics
|
||||
def synchronize
|
||||
Rails.logger.warn("DistributedMutex.synchronize called inside a request lifecycle") if Thread.current["_in_request"]
|
||||
result = nil
|
||||
|
||||
@mutex.synchronize do
|
||||
|
||||
Reference in New Issue
Block a user