lib/lambda_punch/worker.rb in lambda_punch-0.0.4 vs lib/lambda_punch/worker.rb in lambda_punch-0.0.5
- old
+ new
@@ -14,11 +14,11 @@
def start!
LambdaPunch.logger.info "Worker.start!..."
require 'timeout'
require 'rb-inotify'
DRb.start_service
- @queue = DRbObject.new_with_uri(Server.uri)
+ new_drb_queue
end
# Creates a new instance of this object with the event payload from the `LambdaPunch::Api#invoke`
# method and immediately performs the `call` method which waits for the function's handler to complete.
#
@@ -29,9 +29,17 @@
# The `@queue` object is the local process' reference to the application `LambdaPunch::Queue`
# instance which does all the work in the applciation's scope.
#
def queue
@queue
+ rescue DRb::DRbConnError
+ new_drb_queue
+ end
+
+ private
+
+ def new_drb_queue
+ @queue = DRbObject.new_with_uri(Server.uri)
end
end
def initialize(event_payload)