clacks 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8cec8c374d947ac86ab6786daa84511fa37fb6d
4
- data.tar.gz: fb521af53dd6ea679a483a3e923d35b1b0bb58ec
3
+ metadata.gz: fcc45107b0075c23d195bc0e155ac464eda44fd0
4
+ data.tar.gz: 51866325d9986a8bef5938d6cb646b7f2e5208c7
5
5
  SHA512:
6
- metadata.gz: cb257eab94536ef5fb17ad1f803214b851cc53ed8c7cec0a13be9fbbdbb3d744ac92713c97c26391aa8c00084d0a4eee101ef4dbe90628221c919ab1701ebfd3
7
- data.tar.gz: 355898f3c5e09358765d114b1fbf3414f73df43f335909947a88e61784034af4ed6517fe8ac85186916f9d4c58a0222204ac306132953b5661834e80bda1b41f
6
+ metadata.gz: 65eea653c97d8df0808c169b24bdeb4f1bd156f735fc6ba7b95336c042c2244c1f516f7ecf7c82d3ae0b8313a944da2519cdc79a8e2dd27faf3944f5efc34443
7
+ data.tar.gz: 562f4c212ef62633ec0dee67427612a8aad891a139fedb5fd9017e8d55878a1660ebafa9836c9194ca6842ce9b293d344f3db282f267d6055719fc8e2f9e6384
@@ -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
  }
@@ -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 = 5 * 60 # 5 minutes
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 is sleeping')
137
+ Clacks.logger.debug('watchdog sleeps')
137
138
  sleep(WATCHDOG_SLEEP)
138
- Clacks.logger.debug('watchdog is awake')
139
+ Clacks.logger.debug('watchdog woke up')
139
140
  @imap.idle_done
140
- Clacks.logger.debug('watchdog send idle done')
141
+ Clacks.logger.debug('watchdog signalled idle process')
141
142
  rescue StandardError => e
142
- Clacks.logger.debug("watchdog received error: #{e.message} (#{e.class})\n#{(e.backtrace || []).join("\n")}")
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)
@@ -1,3 +1,3 @@
1
1
  module Clacks
2
- VERSION = '1.1.5'
2
+ VERSION = '1.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITRP