Commit c1c8130bfd4fe32ecd054e94eba36923ca092b2b
1 parent
20150705
Exists in
master
and in
19 other branches
Friendlier notifications [skip ci]
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
lib/searchkick/index.rb
... | ... | @@ -444,7 +444,7 @@ module Searchkick |
444 | 444 | |
445 | 445 | with_retries do |
446 | 446 | # bulk reindex |
447 | - possibly_bulk do | |
447 | + possibly_bulk(delete_records.any?) do | |
448 | 448 | if records.any? |
449 | 449 | method_name ? bulk_update(records, method_name) : import(records) |
450 | 450 | end |
... | ... | @@ -473,9 +473,10 @@ module Searchkick |
473 | 473 | Searchkick.redis |
474 | 474 | end |
475 | 475 | |
476 | - # use bulk if no callbacks value set | |
477 | - def possibly_bulk | |
478 | - if Searchkick.callbacks_value | |
476 | + # use bulk if no callbacks value set and deleted records | |
477 | + # if no deleted records, we can show friendlier notifications | |
478 | + def possibly_bulk(deleted_records) | |
479 | + if Searchkick.callbacks_value || !deleted_records | |
479 | 480 | yield |
480 | 481 | else |
481 | 482 | Searchkick.callbacks(:bulk) do | ... | ... |