kithe 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cbc1b16f14b74c3345679a500aee3748f09b3a61a8f0b7d38b4bb1d40d1f888
4
- data.tar.gz: 5628ccf08053147a0685c5c695c95fee7fcdb13033802782a3b4832ccffe59be
3
+ metadata.gz: 675e05528a33eb6b29c34c8a3c55f19ba82b937d0eb41b61fcc632af0383dee1
4
+ data.tar.gz: 43fd9b34e684e369e910e295d1bca21a00c53c10b0fa2cec0a74323351b09382
5
5
  SHA512:
6
- metadata.gz: 7ffcbf916d6d8cdad7e5292fb1588f89fb3935d142cff917ee6347447da6f47f523f781983011fedc18bc10eedb3f0de6fa6b9b9b75ffb341647e38b4d4cf1b7
7
- data.tar.gz: bb54a54108296909dd219e4e42c5bed5df5b999688b6bd596172f1219a2c1bb7717bbd1de6fd67af32bfa909f76152b19a558821ccffb23efae3607488fecc04
6
+ metadata.gz: e575adc1d2ae9ab6b7f78d2938468c696a1a5fd37a2d964b1a09ab0b3ef0b85ed15ad25bb4946e6069a79d043efb08449e72203281978617eca3ec5e5eb1343e
7
+ data.tar.gz: 0a645f019d8ff8246d07cc29be08d937e9a2af40974746c557973a907aa36ba0be53cf0b75983a044b30899099fda6ebbfd637c25c48a15d2db2d3c19c969ec4
@@ -0,0 +1,34 @@
1
+ module Kithe
2
+ # Can be included in a controller, or usually in ApplicationController for your
3
+ # whole app, to batch solr indexing that takes place in a controller action, into
4
+ # a single or fewer solr index commands.
5
+ #
6
+ # We used to just have implementers write this simple code in thier local app, which
7
+ # works fine, but you wind up with the around filter in all your stack traces, since
8
+ # it's around every action.
9
+ #
10
+ # So instead, just
11
+ #
12
+ # include Kithe::BatchIndexableAroundAction
13
+ #
14
+ # in eg ApplicationController
15
+ #
16
+ module BatchIndexableAroundAction
17
+ extend ActiveSupport::Concern
18
+
19
+ included do
20
+ around_action :_kithe_batch_indexable_around_action
21
+ end
22
+
23
+ # Used as a Rails controller around_action to batch any kithe indexing directives
24
+ # in a controller action.
25
+ #
26
+ # As `index_with(batching: true)` only creates a Traject::Writer lazily on demand,
27
+ # this should not add appreciable overhead to actions that don't end up triggering any Solr updates.
28
+ def _kithe_batch_indexable_around_action
29
+ Kithe::Indexable.index_with(batching: true) do
30
+ yield
31
+ end
32
+ end
33
+ end
34
+ end
data/lib/kithe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kithe
2
- VERSION = '2.18.0'
2
+ VERSION = '2.19.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kithe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.0
4
+ version: 2.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -360,6 +360,7 @@ files:
360
360
  - app/characterization/kithe/exiftool_characterization.rb
361
361
  - app/characterization/kithe/exiftool_characterization/result.rb
362
362
  - app/characterization/kithe/ffprobe_characterization.rb
363
+ - app/controllers/concerns/kithe/batch_indexable_around_action.rb
363
364
  - app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb
364
365
  - app/derivative_transformers/kithe/ffmpeg_transformer.rb
365
366
  - app/derivative_transformers/kithe/vips_cli_image_to_jpeg.rb