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

#execute, #in_transaction?, #wake_worker_after_commit

Constructor Details

#initialize(pg) ⇒ PG

Returns a new instance of PG.



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

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.



6
7
8
# File 'lib/que/adapters/pg.rb', line 6

def lock
  @lock
end

Instance Method Details

#checkoutObject



14
15
16
# File 'lib/que/adapters/pg.rb', line 14

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