{"action":"created","issue":{"url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/44","repository_url":"https://api.github.com/repos/lukefx/hubot-telegram","labels_url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/44/comments","events_url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/44/events","html_url":"https://github.com/lukefx/hubot-telegram/pull/44","id":144191083,"number":44,"title":"Move the offset update into the getUpdates method. #43","user":{"login":"arcturial","id":1466729,"avatar_url":"https://avatars.githubusercontent.com/u/1466729?v=3","gravatar_id":"","url":"https://api.github.com/users/arcturial","html_url":"https://github.com/arcturial","followers_url":"https://api.github.com/users/arcturial/followers","following_url":"https://api.github.com/users/arcturial/following{/other_user}","gists_url":"https://api.github.com/users/arcturial/gists{/gist_id}","starred_url":"https://api.github.com/users/arcturial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arcturial/subscriptions","organizations_url":"https://api.github.com/users/arcturial/orgs","repos_url":"https://api.github.com/users/arcturial/repos","events_url":"https://api.github.com/users/arcturial/events{/privacy}","received_events_url":"https://api.github.com/users/arcturial/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-29T08:15:15Z","updated_at":"2016-03-30T14:45:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lukefx/hubot-telegram/pulls/44","html_url":"https://github.com/lukefx/hubot-telegram/pull/44","diff_url":"https://github.com/lukefx/hubot-telegram/pull/44.diff","patch_url":"https://github.com/lukefx/hubot-telegram/pull/44.patch"},"body":"To reduce duplicate messages, update the offset immediately when Telegram responds."},"comment":{"url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/comments/203467530","html_url":"https://github.com/lukefx/hubot-telegram/pull/44#issuecomment-203467530","issue_url":"https://api.github.com/repos/lukefx/hubot-telegram/issues/44","id":203467530,"user":{"login":"lukefx","id":28878,"avatar_url":"https://avatars.githubusercontent.com/u/28878?v=3","gravatar_id":"","url":"https://api.github.com/users/lukefx","html_url":"https://github.com/lukefx","followers_url":"https://api.github.com/users/lukefx/followers","following_url":"https://api.github.com/users/lukefx/following{/other_user}","gists_url":"https://api.github.com/users/lukefx/gists{/gist_id}","starred_url":"https://api.github.com/users/lukefx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukefx/subscriptions","organizations_url":"https://api.github.com/users/lukefx/orgs","repos_url":"https://api.github.com/users/lukefx/repos","events_url":"https://api.github.com/users/lukefx/events{/privacy}","received_events_url":"https://api.github.com/users/lukefx/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T14:45:47Z","updated_at":"2016-03-30T14:45:47Z","body":"> We can. However, if the handleUpdate method is slow it might hold up the loop. For example, if you receive 5 messages and handling each message takes 1 second. If your setInterval is 2 seconds, you will end up with atleast 2 duplicate messages. Does that make sense?\r\n\r\nyepp absolutely...aaaaand, what about move offset just to the last update_id without a loop?\r\n\r\n```coffeescript\r\nself.offset = result[result.length-1].update_id if result.length\r\n\r\nfor msg in result\r\n  self.handleUpdate msg\r\n```\r\n"}}