-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00e5d86
commit feead2f
Showing
5 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
class IIIFIngestJob < ActiveJob::Base | ||
# Ingest one or more IIIF manfiest URLs. Each manifest is ingested as its | ||
# own resource. | ||
def perform(urls, exhibit) | ||
def perform(urls, exhibit, log_entry) | ||
Array.wrap(urls).each do |url| | ||
ingest url, exhibit | ||
end | ||
|
||
# Lock the row to prevent multiple workers from overwriting each other's increments. | ||
# This worked, but it's reporting complete before the objects are reindexed. | ||
# app/models/spotlight/resource.rb:55 has a null reindexing_log_entry. | ||
log_entry.with_lock do | ||
previous = log_entry.items_reindexed_count || 0 | ||
log_entry.update(items_reindexed_count: previous + Array.wrap(urls).size) | ||
end | ||
end | ||
|
||
# Ingest a single IIIF manifest URL as a resource. | ||
def ingest(url, exhibit) | ||
IIIFResource.find_or_initialize_by(url: url, exhibit_id: exhibit.id).save_and_index | ||
IIIFResource.find_or_initialize_by(url: url, exhibit_id: exhibit.id).save_and_index_now | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters