Skip to content

Commit

Permalink
Fix: intervals may not always be started in an async block.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jul 25, 2023
1 parent 7233511 commit 5f67157
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 2.1.1 (Next)

* [#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).
* Your contribution here.

### 2.1.0 (2023/03/06)
Expand Down
12 changes: 7 additions & 5 deletions lib/slack-ruby-bot-server/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def start_from_database!
end

def start_intervals!
@intervals.each_pair do |period, calls_with_options|
calls_with_options.each do |call_with_options|
call, options = *call_with_options
_every period, options do
call.call
::Async::Reactor.run do
@intervals.each_pair do |period, calls_with_options|
calls_with_options.each do |call_with_options|
call, options = *call_with_options
_every period, options do
call.call
end
end
end
end
Expand Down

0 comments on commit 5f67157

Please sign in to comment.