blob: 86f924e05a46dbc916d3474e65afba6cf172e1fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#
# 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
begin
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
rescue SystemCallError => exc
Tapicero.logger.info('Problem connecting to couchdb (#{exc}). Will try again in 10 seconds.')
sleep 10
retry
end
end
end
end
|