We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82c2b38 commit 65ceaa5Copy full SHA for 65ceaa5
src/tourmaline/poller.cr
@@ -18,16 +18,24 @@ module Tourmaline
18
Log.info { "Polling for updates..." }
19
@polling = true
20
while @polling
21
- updates = @client.get_updates(offset: offset, timeout: 30)
22
- updates.each do |update|
23
- @client.dispatcher.process(update)
24
- @offset = Int64.new(update.update_id + 1)
25
- end
+ poll_and_dispatch
26
end
27
28
29
def stop
30
@polling = false
31
+
+ def poll_and_dispatch
+ updates = get_updates
+ updates.each do |update|
32
+ @client.dispatcher.process(update)
33
+ @offset = Int64.new(update.update_id + 1)
34
+ end
35
36
37
+ def get_updates
38
+ @client.get_updates(offset: offset, timeout: 30)
39
40
41
0 commit comments