Commit 6b01d0222b083b3b9f4b76e270ab9080b14b6528
1 parent
44374321
Exists in
master
and in
19 other branches
Added info about controlling concurrency [skip ci]
Showing
1 changed file
with
17 additions
and
0 deletions
Show diff stats
README.md
@@ -1199,6 +1199,23 @@ And use: | @@ -1199,6 +1199,23 @@ And use: | ||
1199 | Searchkick.reindex_status(index_name) | 1199 | Searchkick.reindex_status(index_name) |
1200 | ``` | 1200 | ``` |
1201 | 1201 | ||
1202 | +You can use [ActiveJob::TrafficControl](https://github.com/nickelser/activejob-traffic_control) to control concurrency. Install the gem and create an initializer with: | ||
1203 | + | ||
1204 | +```ruby | ||
1205 | +require "active_job/traffic_control" | ||
1206 | + | ||
1207 | +Searchkick.redis = Redis.new | ||
1208 | +ActiveJob::TrafficControl.client = Searchkick.redis | ||
1209 | + | ||
1210 | +class Searchkick::BulkReindexJob | ||
1211 | + include ActiveJob::TrafficControl::Concurrency | ||
1212 | + | ||
1213 | + concurrency 3, drop: false | ||
1214 | +end | ||
1215 | +``` | ||
1216 | + | ||
1217 | +This will allow only 3 jobs to run at once. | ||
1218 | + | ||
1202 | ### Refresh Interval | 1219 | ### Refresh Interval |
1203 | 1220 | ||
1204 | You can specify a longer refresh interval while reindexing to increase performance. | 1221 | You can specify a longer refresh interval while reindexing to increase performance. |