clacks 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clacks/service.rb +11 -5
- data/lib/clacks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a1c27d5e5f6c56ee4b1d62cde1fd55b1a4757e6
|
4
|
+
data.tar.gz: c1b698e3b81baec4608e9c4a302f1f04dbe5020f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfffd9efadc5f9801a004b70bc34a5ddeeb4eed17ccb4d4b4a6e206ac5999ee709f6277838404faaf6dc65334ebdb535f96f4627554a56f233eaf8205debdb37
|
7
|
+
data.tar.gz: 9e70bd29df57273484a6e14b96a639a3e805947f76a6603c089b6fb9a337562799b348169a2575d55bdc0276ac07d5fbd55d17621434182e956155c83a4f1c39
|
data/lib/clacks/service.rb
CHANGED
@@ -11,7 +11,7 @@ module Clacks
|
|
11
11
|
# NAT Gateway timeout: typically after 15 minutes with an idle connection.
|
12
12
|
# The solution to this is for the IMAP client to issue a NOOP (No Operation) command
|
13
13
|
# at intervals, typically every 12 minutes.
|
14
|
-
|
14
|
+
WATCHDOG_SLEEP = 5 * 60 # 5 minutes
|
15
15
|
|
16
16
|
def run
|
17
17
|
begin
|
@@ -88,7 +88,7 @@ module Clacks
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def imap_idling(processor)
|
91
|
-
|
91
|
+
imap_watchdog
|
92
92
|
loop do
|
93
93
|
begin
|
94
94
|
processor.connection do |imap|
|
@@ -100,6 +100,7 @@ module Clacks
|
|
100
100
|
finding { imap_find(imap) }
|
101
101
|
# http://tools.ietf.org/rfc/rfc2177.txt
|
102
102
|
imap.idle do |r|
|
103
|
+
Clacks.logger.debug('imap.idle yields')
|
103
104
|
if r.instance_of?(Net::IMAP::UntaggedResponse) && r.name == 'EXISTS'
|
104
105
|
imap.idle_done unless r.data == 0
|
105
106
|
elsif r.instance_of?(Net::IMAP::ContinuationRequest)
|
@@ -125,14 +126,19 @@ module Clacks
|
|
125
126
|
end
|
126
127
|
end
|
127
128
|
|
128
|
-
def
|
129
|
+
def imap_watchdog
|
129
130
|
Thread.new do
|
130
131
|
loop do
|
131
132
|
begin
|
132
|
-
|
133
|
+
Clacks.logger.debug('watchdog is sleeping')
|
134
|
+
sleep(WATCHDOG_SLEEP)
|
135
|
+
Clacks.logger.debug('watchdog is awake')
|
133
136
|
@imap.idle_done
|
137
|
+
Clacks.logger.debug('watchdog send idle done')
|
134
138
|
@imap.noop
|
135
|
-
|
139
|
+
Clacks.logger.debug('watchdog send noop')
|
140
|
+
rescue StandardError => e
|
141
|
+
Clacks.logger.debug("watchdog received error: #{e.message}")
|
136
142
|
# noop
|
137
143
|
rescue Exception => e
|
138
144
|
fatal(e)
|
data/lib/clacks/version.rb
CHANGED