clacks 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clacks/service.rb +7 -6
- 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: a8cec8c374d947ac86ab6786daa84511fa37fb6d
|
4
|
+
data.tar.gz: fb521af53dd6ea679a483a3e923d35b1b0bb58ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb257eab94536ef5fb17ad1f803214b851cc53ed8c7cec0a13be9fbbdbb3d744ac92713c97c26391aa8c00084d0a4eee101ef4dbe90628221c919ab1701ebfd3
|
7
|
+
data.tar.gz: 355898f3c5e09358765d114b1fbf3414f73df43f335909947a88e61784034af4ed6517fe8ac85186916f9d4c58a0222204ac306132953b5661834e80bda1b41f
|
data/lib/clacks/service.rb
CHANGED
@@ -10,7 +10,7 @@ module Clacks
|
|
10
10
|
# IMAP server timeout: typically after 30 minutes with no activity.
|
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
|
-
# at intervals, typically every
|
13
|
+
# at intervals, typically every 29 minutes.
|
14
14
|
WATCHDOG_SLEEP = 5 * 60 # 5 minutes
|
15
15
|
|
16
16
|
def run
|
@@ -55,8 +55,10 @@ module Clacks
|
|
55
55
|
config = Clacks.config[:imap]
|
56
56
|
options = Clacks.config[:find_options]
|
57
57
|
processor = Mail::IMAP.new(config)
|
58
|
-
|
59
|
-
|
58
|
+
if $DEBUG
|
59
|
+
Net::IMAP.debug = true
|
60
|
+
Clacks.logger.level = Logger::DEBUG
|
61
|
+
end
|
60
62
|
imap_validate_options(options)
|
61
63
|
if imap_idle_support?(processor)
|
62
64
|
Clacks.logger.info("Clacks IMAP idling #{config[:user_name]}@#{config[:address]}")
|
@@ -99,6 +101,7 @@ module Clacks
|
|
99
101
|
break if stopping?
|
100
102
|
finding { imap_find(imap) }
|
101
103
|
# http://tools.ietf.org/rfc/rfc2177.txt
|
104
|
+
Clacks.logger.debug('imap.idle start')
|
102
105
|
imap.idle do |r|
|
103
106
|
Clacks.logger.debug('imap.idle yields')
|
104
107
|
if r.instance_of?(Net::IMAP::UntaggedResponse) && r.name == 'EXISTS'
|
@@ -135,10 +138,8 @@ module Clacks
|
|
135
138
|
Clacks.logger.debug('watchdog is awake')
|
136
139
|
@imap.idle_done
|
137
140
|
Clacks.logger.debug('watchdog send idle done')
|
138
|
-
@imap.noop
|
139
|
-
Clacks.logger.debug('watchdog send noop')
|
140
141
|
rescue StandardError => e
|
141
|
-
Clacks.logger.debug("watchdog received error: #{e.message}")
|
142
|
+
Clacks.logger.debug("watchdog received error: #{e.message} (#{e.class})\n#{(e.backtrace || []).join("\n")}")
|
142
143
|
# noop
|
143
144
|
rescue Exception => e
|
144
145
|
fatal(e)
|
data/lib/clacks/version.rb
CHANGED