Commit c5393af6c8f430b647b45ce42611cba110ca0270

Authored by Stephen Crosby
2 parents 9e861299 377184be
Exists in master and in 1 other branch production

Merge #997, resolve conflict with master

app/models/notification_services/gtalk_service.rb
... ... @@ -41,18 +41,21 @@ class NotificationServices::GtalkService < NotificationService
41 41  
42 42 def create_notification(problem)
43 43 # build the xmpp client
44   - client = Jabber::Client.new(Jabber::JID.new(subdomain))
45   - client.connect(service)
46   - client.auth(api_token)
  44 + client = nil
  45 + Timeout.timeout(5) do
  46 + client = Jabber::Client.new(Jabber::JID.new(subdomain))
  47 + client.connect(service)
  48 + client.auth(api_token)
47 49  
48   - # has to look like this to be formatted properly in the client
49   - message = """#{problem.app.name}\n" \
50   - "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}\n" \
51   - "#{notification_description problem}"""
  50 + # has to look like this to be formatted properly in the client
  51 + message = """#{problem.app.name}\n" \
  52 + "#{Errbit::Config.protocol}://#{Errbit::Config.host}/apps/#{problem.app.id}\n" \
  53 + "#{notification_description problem}"""
52 54  
53   - # post the issue to the xmpp room(s)
54   - send_to_users(client, message) unless user_id.blank?
55   - send_to_muc(client, message) unless room_id.blank?
  55 + # post the issue to the xmpp room(s)
  56 + send_to_users(client, message) unless user_id.blank?
  57 + send_to_muc(client, message) unless room_id.blank?
  58 + end
56 59 ensure
57 60 client.close unless client.nil?
58 61 end
... ...