Compare commits

...
This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.

1 Commits

Author SHA1 Message Date
Jarek Radosz
ab0cefe54a
DEV: Warn if distributed-mutexing in a request 2022-08-12 20:59:57 +02:00
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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