Class: Que::Adapters::PG

Inherits:
Base
  • Object
show all
Defined in:
lib/que/adapters/pg.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#cleanup!, #execute, #in_transaction?, #wake_worker_after_commit

Constructor Details

#initialize(pg) ⇒ PG

Returns a new instance of PG.



10
11
12
13
14
# File 'lib/que/adapters/pg.rb', line 10

def initialize(pg)
  @pg   = pg
  @lock = Monitor.new # Must be re-entrant.
  super
end

Instance Attribute Details

#lockObject (readonly)

Returns the value of attribute lock.



8
9
10
# File 'lib/que/adapters/pg.rb', line 8

def lock
  @lock
end

Instance Method Details

#checkoutObject



16
17
18
# File 'lib/que/adapters/pg.rb', line 16

def checkout
  @lock.synchronize { yield @pg }
end