lib/alephant/publisher.rb in alephant-publisher-0.1.4 vs lib/alephant/publisher.rb in alephant-publisher-0.1.5
- old
+ new
@@ -20,15 +20,16 @@
Publisher.new(opts, logger)
end
class Publisher
- VISIBILITY_TIMEOUT = 300
- KEEP_ALIVE_TIMEOUT = 300
+ VISIBILITY_TIMEOUT = 60
+ KEEP_ALIVE_TIMEOUT = 60
RECEIVE_WAIT_TIME = 15
POOL_MIN_SIZE = 2
POOL_MAX_SIZE = 4
+ QUEUE_THROTTLE = 0.5
attr_reader :queue, :executor
def initialize(opts, logger)
::Alephant::Logger.set_logger(logger) unless logger.nil?
@@ -70,9 +71,11 @@
@writer_opts,
@queue.message
)
)
)
+
+ sleep QUEUE_THROTTLE while executor.getActiveCount == executor.getMaximumPoolSize
end
executor.shutdown()
end
end