README.md in slack-ruby-bot-server-2.0.1 vs README.md in slack-ruby-bot-server-2.1.0
- old
+ new
@@ -38,11 +38,11 @@
A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service, or [slack-ruby-bot-server-rtm](https://github.com/slack-ruby/slack-ruby-bot-server-rtm) to build a (legacy) Classic RealTime Slack bot. Your customers can use a Slack button to install the bot.
## Stable Release
-You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.0.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
+You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.1.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
## Make Your Own
This library alone will only register a new bot, but will not include any bot functionality. To make something useful, we recommend you get started from either [slack-ruby-bot-server-events-app-mentions-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-app-mentions-sample) (handles a single kind of event), or [slack-ruby-bot-server-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample) (handles all kinds of events) to bootstrap your project.
@@ -64,10 +64,11 @@
```
#### ActiveRecord
Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Add the `activerecord`, `pg`, `otr-activerecord` and `pagy_cursor` gems to your Gemfile.
+Currently supports ActiveRecord/Rails major versions 6.0, 6.1 and 7.0.
```
gem 'pg'
gem 'activerecord', require: 'active_record'
gem 'slack-ruby-bot-server'
@@ -235,14 +236,12 @@
end
```
##### Service Timers
-You can introduce custom behavior into the service lifecycle on a timer. For example, check whether a team's trial has expired, or periodically cleanup data.
+You can introduce custom behavior into the service lifecycle on a timer. For example, check whether a team's trial has expired, or periodically clean-up data. Timers can run once on start (`once_and_every`) and start running after a certain period (`every`).
-Note that unlike callbacks, timers are global for the entire service.
-
```ruby
instance = SlackRubyBotServer::Service.instance
instance.every :hour do
Team.each do |team|
@@ -251,10 +250,14 @@
rescue StandardError
end
end
end
+instance.once_and_every :minute do
+ # called once on start, then every minute
+end
+
instance.every :minute do
# called every minute
end
instance.every :second do
@@ -263,9 +266,11 @@
instance.every 30 do
# called every 30 seconds
end
```
+
+Note that, unlike callbacks, timers are global for the entire service. Timers are independent, and a failing timer will not terminate other timers.
##### Extensions
A number of extensions use service manager callbacks and service timers to implement useful functionality.