5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/rhack/curl/global.rb', line 5
def execute(raise_errors=false)
if @@carier_thread and s = @@carier_thread.status
L.log "Carier Thread allready started and has status #{s}"
else
if s = status(raise_errors)
L.warn s
end
L.log(@@carier_thread ? "Resetting Carier thread" : "Setting Carier thread up")
@@carier_thread = thread {
error = nil
begin
yield if block_given?
rescue => error
nil
end
loop {
begin
break unless @@carier.perform true
L.log "All requests have been performed; idling..."
rescue => error
L.log "Catched #{error.class.name} in Carier Thread"
break
end
} unless error
L.log "Nothing to perform; recalling..."
error
}
sleep 0.001
true
end
end
|