clacks 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clacks/configurator.rb +1 -1
- 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: fcc45107b0075c23d195bc0e155ac464eda44fd0
|
4
|
+
data.tar.gz: 51866325d9986a8bef5938d6cb646b7f2e5208c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65eea653c97d8df0808c169b24bdeb4f1bd156f735fc6ba7b95336c042c2244c1f516f7ecf7c82d3ae0b8313a944da2519cdc79a8e2dd27faf3944f5efc34443
|
7
|
+
data.tar.gz: 562f4c212ef62633ec0dee67427612a8aad891a139fedb5fd9017e8d55878a1660ebafa9836c9194ca6842ce9b293d344f3db282f267d6055719fc8e2f9e6384
|
data/lib/clacks/configurator.rb
CHANGED
@@ -5,7 +5,7 @@ module Clacks
|
|
5
5
|
|
6
6
|
DEFAULTS = {
|
7
7
|
:poll_interval => 60,
|
8
|
-
:logger => Logger.new($stderr),
|
8
|
+
:logger => Logger.new($stderr).tap { |logger| logger.level = Logger::INFO },
|
9
9
|
:on_mail => lambda { |mail|
|
10
10
|
Clacks.logger.info("Mail from #{mail.from.first}, subject: #{mail.subject}")
|
11
11
|
}
|
data/lib/clacks/service.rb
CHANGED
@@ -10,8 +10,8 @@ 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 29 minutes.
|
14
|
-
WATCHDOG_SLEEP =
|
13
|
+
# at intervals, typically every 29 minutes. We choose default 10 minutes.
|
14
|
+
WATCHDOG_SLEEP = ENV['CLACKS_WATCHDOG_SLEEP'] || 10 * 60 # default 10 minutes
|
15
15
|
|
16
16
|
def run
|
17
17
|
begin
|
@@ -129,17 +129,18 @@ module Clacks
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
# http://tools.ietf.org/rfc/rfc2177.txt
|
132
133
|
def imap_watchdog
|
133
134
|
Thread.new do
|
134
135
|
loop do
|
135
136
|
begin
|
136
|
-
Clacks.logger.debug('watchdog
|
137
|
+
Clacks.logger.debug('watchdog sleeps')
|
137
138
|
sleep(WATCHDOG_SLEEP)
|
138
|
-
Clacks.logger.debug('watchdog
|
139
|
+
Clacks.logger.debug('watchdog woke up')
|
139
140
|
@imap.idle_done
|
140
|
-
Clacks.logger.debug('watchdog
|
141
|
+
Clacks.logger.debug('watchdog signalled idle process')
|
141
142
|
rescue StandardError => e
|
142
|
-
Clacks.logger.debug
|
143
|
+
Clacks.logger.debug { "watchdog received error: #{e.message} (#{e.class})\n#{(e.backtrace || []).join("\n")}" }
|
143
144
|
# noop
|
144
145
|
rescue Exception => e
|
145
146
|
fatal(e)
|
data/lib/clacks/version.rb
CHANGED