Class: NoBrainer::QueryRunner::ConnectionLock
- Inherits:
-
Middleware
- Object
- Middleware
- NoBrainer::QueryRunner::ConnectionLock
- Defined in:
- lib/no_brainer/query_runner/connection_lock.rb
Constant Summary collapse
- @@lock =
Mutex.new
Instance Method Summary collapse
Methods inherited from Middleware
Constructor Details
This class inherits a constructor from NoBrainer::QueryRunner::Middleware
Instance Method Details
#call(env) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/no_brainer/query_runner/connection_lock.rb', line 4 def call(env) if NoBrainer::Config.per_thread_connection @runner.call(env) else @@lock.synchronize { @runner.call(env) } end end |