lib/sqsrun/worker.rb in sqsrun-0.6.0 vs lib/sqsrun/worker.rb in sqsrun-0.6.1
- old
+ new
@@ -13,10 +13,11 @@
@extend_timeout = conf[:extend_timeout]
@kill_timeout = conf[:kill_timeout]
@kill_retry = conf[:kill_retry]
@interval = conf[:interval]
@release_on_fail = conf[:release_on_fail]
+ @env = conf[:env] || {}
@finished = false
@extender = TimerThread.new(@visibility_timeout, @extend_timeout, @kill_timeout, @kill_retry)
@sqs = RightAws::SqsGen2.new(@key_id, @secret_key)
@queue = @sqs.queue(@queue_name)
@@ -77,9 +78,13 @@
end
end
def process(msg)
puts "started id=#{msg.id}"
+
+ @env.each_pair {|k,v|
+ ENV[k] = v
+ }
@extender.set_message(msg)
success = false
begin