Class: Clacks::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/clacks/service.rb

Constant Summary collapse

IMAP_NOOP_SLEEP =

In practice timeouts occur when there is no activity keeping an IMAP connection open. Timeouts occuring are:

IMAP server timeout: typically after 30 minutes with no activity.
NAT Gateway timeout: typically after 15 minutes with an idle connection.

The solution to this is for the IMAP client to issue a NOOP (No Operation) command at intervals, typically every 15 minutes.

15 * 60

Instance Method Summary collapse

Instance Method Details

#runObject

15 minutes



16
17
18
19
20
21
22
23
24
25
# File 'lib/clacks/service.rb', line 16

def run
  Clacks.logger.info "Clacks v#{Clacks::VERSION} started"
  if Clacks.config[:pop3]
    run_pop3
  elsif Clacks.config[:imap]
    run_imap
  else
    raise "Either a POP3 or an IMAP server must be configured"
  end
end

#stopObject



27
28
29
30
# File 'lib/clacks/service.rb', line 27

def stop
  $STOPPING = true
  exit unless finding?
end