10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/atig/db/transaction.rb', line 10
def init
return if @queue
debug "transaction thread start"
@queue = SizedQueue.new 10
daemon do
f,src = @queue.pop
debug "transaction is poped at #{src}"
if respond_to?(:timeout_interval) && timeout_interval > 0 then
begin
timeout(timeout_interval){ f.call self }
rescue TimeoutError
debug "transaction is timeout at #{src}"
end
else
f.call self
end
debug "transaction is finished at #{src}"
end
end
|