Skip to content

Commit 5f67157

Browse files
committed
Fix: intervals may not always be started in an async block.
1 parent 7233511 commit 5f67157

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### 2.1.1 (Next)
44

5+
* [#172](https://github.com/slack-ruby/slack-ruby-bot-server/pull/172): Fix: intervals may not always be started in an async block - [@dblock](https://github.com/dblock).
56
* Your contribution here.
67

78
### 2.1.0 (2023/03/06)

lib/slack-ruby-bot-server/service.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ def start_from_database!
7979
end
8080

8181
def start_intervals!
82-
@intervals.each_pair do |period, calls_with_options|
83-
calls_with_options.each do |call_with_options|
84-
call, options = *call_with_options
85-
_every period, options do
86-
call.call
82+
::Async::Reactor.run do
83+
@intervals.each_pair do |period, calls_with_options|
84+
calls_with_options.each do |call_with_options|
85+
call, options = *call_with_options
86+
_every period, options do
87+
call.call
88+
end
8789
end
8890
end
8991
end

0 commit comments

Comments
 (0)