lib/stasis/server.rb in stasis-0.1.10 vs lib/stasis/server.rb in stasis-0.1.11

- old
+ new

@@ -1,6 +1,7 @@ -Stasis::Gems.activate %w(redis yajl-ruby) +gem "redis", "~> 2.2.1" +gem "yajl-ruby", "~> 0.8.2" require 'digest/sha1' require 'redis' require 'yajl' @@ -10,10 +11,11 @@ def initialize(root, options={}) puts "\nStarting Stasis server (redis @ #{options[:server]})..." redis = Redis.connect(:url => "redis://#{options[:server]}") stasis = Stasis.new(*[ root, options[:public], options ].compact) + retries = 0 begin while true sleep(1.0 / 1000.0) request = redis.lpop('stasis:requests') @@ -63,9 +65,11 @@ rescue Interrupt shut_down rescue Exception => e puts "\nError: #{e.message}" puts "\t#{e.backtrace.join("\n\t")}" + retries += 1 + shut_down if retries >= 10 retry end end def shut_down \ No newline at end of file