summaryrefslogtreecommitdiff
path: root/lib/tapicero_daemon.rb
blob: 9eb342bc490d7264a1c922a0822e457cf3f628f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# This file should not be required directly. Use the wrapper in /bin
# instead or run this using daemons:
#
#  Daemons.run('tapicero_daemon.rb')
#
require 'tapicero'
require 'extends/couchrest'
require 'tapicero/user_event_handler'

module Tapicero
  module Daemon
    while true
      users = CouchRest::Changes.new('users')
      UserEventHandler.new(users)
      users.listen
      Tapicero.logger.info('Lost contact with couchdb, will try again in 10 seconds')
      sleep 10
    end
  end
end