sul-dlss / purl

URL resolver that translates a reference to a digital object in the form of a druid, into a full content representation of that object as available
Other
8 stars 1 forks source link

Inject ResourceRetriever into PurlVersion to avoid duplication #1117

Closed aaron-collier closed 1 month ago

aaron-collier commented 1 month ago

Fixes #1107

By injecting a ResourceRetriever into PurlVersion this removes the need to instantiate a ResourceRetriever for each version which causes duplicate fetches of the version manifest when determining if an object is versioned.

Logging confirms the duplicate fetch is removed.

Processing by PurlController#show as HTML
  Parameters: {"id"=>"wp335yr5649", "version"=>"3"}
Fetching wp335yr5649 version_manifest at /Users/amcollie/github/sul-dlss/purl/spec/fixtures/document_cache/wp/335/yr/5649/wp335yr5649/versions/versions.json (0.1ms)
Fetching wp335yr5649 public_xml at /Users/amcollie/github/sul-dlss/purl/spec/fixtures/document_cache/wp/335/yr/5649/wp335yr5649/versions/public.3.xml (0.0ms)
jcoyne commented 1 month ago

Maybe the ResourceRetriever can just become the VersionManifestResource ?

aaron-collier commented 1 month ago

@jcoyne let me think through that, we can obviously hold this for a bit.

aaron-collier commented 1 month ago

Replaced by #1118