lib/propono/services/publisher.rb in propono-0.7.0 vs lib/propono/services/publisher.rb in propono-0.8.0
- old
+ new
@@ -1,6 +1,7 @@
require 'socket'
+require 'thread/future'
module Propono
class PublisherError < ProponoError
end
@@ -29,10 +30,12 @@
private
def publish_via_sns
topic = TopicCreator.find_or_create(topic_id)
msg = message.is_a?(String) ? message : message.to_json
- sns.publish(topic.arn, msg)
+ Thread.future(WORKER_POOL) do
+ sns.publish(topic.arn, msg)
+ end
end
def publish_via_udp
payload = {topic: topic_id, message: message}.to_json
UDPSocket.new.send(payload, 0, Propono.config.udp_host, Propono.config.udp_port)