Class: Logidze::Utils::CheckPending

Inherits:
Object
  • Object
show all
Defined in:
lib/logidze/utils/check_pending.rb

Overview

This Rack middleware is used to verify that all functions are up to date

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CheckPending

Returns a new instance of CheckPending.



10
11
12
13
14
# File 'lib/logidze/utils/check_pending.rb', line 10

def initialize(app)
  @app = app
  @needs_check = true
  @mutex = Mutex.new
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/logidze/utils/check_pending.rb', line 18

def call(env)
  @mutex.synchronize do
    if @needs_check
      notify_or_raise! if needs_migration?
    end
    @needs_check = false
  end

  @app.call(env)
end