diff options
Diffstat (limited to 'lib/tapicero_daemon.rb')
-rw-r--r-- | lib/tapicero_daemon.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/tapicero_daemon.rb b/lib/tapicero_daemon.rb index 9eb342b..86f924e 100644 --- a/lib/tapicero_daemon.rb +++ b/lib/tapicero_daemon.rb @@ -11,11 +11,17 @@ 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 + 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 |