diff --git a/app/models/notification_services/gtalk_service.rb b/app/models/notification_services/gtalk_service.rb index e68f719..c19397f 100644 --- a/app/models/notification_services/gtalk_service.rb +++ b/app/models/notification_services/gtalk_service.rb @@ -41,18 +41,21 @@ class NotificationServices::GtalkService < NotificationService def create_notification(problem) # build the xmpp client - client = Jabber::Client.new(Jabber::JID.new(subdomain)) - client.connect(service) - client.auth(api_token) + client = nil + Timeout.timeout(5) do + client = Jabber::Client.new(Jabber::JID.new(subdomain)) + client.connect(service) + client.auth(api_token) - #has to look like this to be formatted properly in the client - message = """#{problem.app.name} + #has to look like this to be formatted properly in the client + message = """#{problem.app.name} #{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id} #{notification_description problem}""" - # post the issue to the xmpp room(s) - send_to_users(client, message) unless user_id.blank? - send_to_muc(client, message) unless room_id.blank? + # post the issue to the xmpp room(s) + send_to_users(client, message) unless user_id.blank? + send_to_muc(client, message) unless room_id.blank? + end ensure client.close unless client.nil? end -- libgit2 0.21.2