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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 350f987d09ce68df28d222611975f0fc401d44f4
4
- data.tar.gz: 763ae401b610b8ad49ee3d584b44e646e89bdffc
3
+ metadata.gz: 8a1c27d5e5f6c56ee4b1d62cde1fd55b1a4757e6
4
+ data.tar.gz: c1b698e3b81baec4608e9c4a302f1f04dbe5020f
5
5
  SHA512:
6
- metadata.gz: 21d86f911494e0f8d82c5a4402f0f0c126375df6d94c0645448842e93d7f4f25413d7012d78a9c22c294ce84cfc346c468a2c0d16a2b781974e5c32147be0e90
7
- data.tar.gz: f8980ca913541a53f8f4c8d65a9837dd17693351268ed9b3953d5ef39a9ada3ee61efc5d7cde69fc21ccbd2ac04b158c809da984cdea4f1d9b122edca3fe8eaf
6
+ metadata.gz: bfffd9efadc5f9801a004b70bc34a5ddeeb4eed17ccb4d4b4a6e206ac5999ee709f6277838404faaf6dc65334ebdb535f96f4627554a56f233eaf8205debdb37
7
+ data.tar.gz: 9e70bd29df57273484a6e14b96a639a3e805947f76a6603c089b6fb9a337562799b348169a2575d55bdc0276ac07d5fbd55d17621434182e956155c83a4f1c39
@@ -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
- IMAP_NOOP_SLEEP = 12 * 60 # 12 minutes
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
- imap_nooper
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 imap_nooper
129
+ def imap_watchdog
129
130
  Thread.new do
130
131
  loop do
131
132
  begin
132
- sleep IMAP_NOOP_SLEEP
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
- rescue StandardError
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)
@@ -1,3 +1,3 @@
1
1
  module Clacks
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
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.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITRP