mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:23:46 +08:00
17 lines
344 B
Ruby
17 lines
344 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class Middleware::ProcessingRequest
|
||
|
PROCESSING_REQUEST_THREAD_KEY = "discourse.processing_request"
|
||
|
|
||
|
def initialize(app)
|
||
|
@app = app
|
||
|
end
|
||
|
|
||
|
def call(env)
|
||
|
Thread.current[PROCESSING_REQUEST_THREAD_KEY] = true
|
||
|
@app.call(env)
|
||
|
ensure
|
||
|
Thread.current[PROCESSING_REQUEST_THREAD_KEY] = nil
|
||
|
end
|
||
|
end
|