Class: Kiqstand::Middleware
- Inherits:
-
Object
- Object
- Kiqstand::Middleware
- Defined in:
- lib/kiqstand/middleware.rb
Overview
This is the middleware for ensuring Moped sessions are diconnected after a worker runs, and that the identity map is cleared.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
Ensures that after each worker runs, the identity map is cleared in case it was accidentally enabled in this environment, and each session disconnects it’s nodes.
Instance Method Details
#call(*args) ⇒ Object
Ensures that after each worker runs, the identity map is cleared in case it was accidentally enabled in this environment, and each session disconnects it’s nodes.
18 19 20 21 22 23 24 25 |
# File 'lib/kiqstand/middleware.rb', line 18 def call(*args) yield ensure if defined?(::Mongoid) ::Mongoid::IdentityMap.clear ::Mongoid.disconnect_sessions end end |