Sha256: f228957ef9511500ece98d2b721e6fe3aa72163e359414dbe5d458e26eec03b4
Contents?: true
Size: 917 Bytes
Versions: 14
Compression:
Stored size: 917 Bytes
Contents
module MailRoom # Coordinate the mailbox watchers # @author Tony Pitale class Coordinator attr_accessor :watchers, :running # build watchers for a set of mailboxes # @params mailboxes [Array<MailRoom::Mailbox>] mailboxes to be watched def initialize(mailboxes) self.watchers = [] mailboxes.each {|box| self.watchers << MailboxWatcher.new(box)} end alias :running? :running # start each of the watchers to running def run watchers.each(&:run) self.running = true sleep_while_running ensure quit end # quit each of the watchers when we're done running def quit watchers.each(&:quit) end private # @private def sleep_while_running # do we need to sweep for dead watchers? # or do we let the mailbox rebuild connections while(running?) do; sleep 1; end end end end
Version data entries
14 entries across 14 versions & 2 rubygems