Skip to content

Commit

Permalink
add save_and_index_now
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Jan 10, 2019
1 parent 9d65c27 commit fddfa62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/jobs/iiif_ingest_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def perform(urls, exhibit, log_entry)

# 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
4 changes: 2 additions & 2 deletions app/models/exhibit_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def initialize(exhibit)
end

def reindex(log_entry)
members.each_slice(50) do |slice|
IIIFIngestJob.perform_later slice, exhibit, log_entry
members.each do |member|
IIIFIngestJob.perform_later member, exhibit, log_entry
end
end

Expand Down
5 changes: 5 additions & 0 deletions app/models/iiif_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def noid
data["noid"]
end

def save_and_index_now(*args)
save(*args)
Spotlight::ReindexJob.perform_now(self)
end

private

def set_noid
Expand Down

0 comments on commit fddfa62

Please sign in to comment.