Skip to content

Instantly share code, notes, and snippets.

@cjcolvar
Last active April 14, 2021 06:02
Show Gist options
  • Save cjcolvar/8f0485e3cf88307228447726b6b55dd3 to your computer and use it in GitHub Desktop.
Save cjcolvar/8f0485e3cf88307228447726b6b55dd3 to your computer and use it in GitHub Desktop.
Monkey-patch initializer to request ntriples when reindexing to avoid timeouts
ActiveFedora::Fedora.class_eval do
def ntriples_connection
authorized_connection.tap { |conn| conn.headers['Accept'] = 'application/n-triples' }
end
def build_ntriples_connection
ActiveFedora::InitializingConnection.new(ActiveFedora::CachingConnection.new(ntriples_connection, omit_ldpr_interaction_model: true), root_resource_path)
end
end
ActiveFedora::Indexing::DescendantFetcher.class_eval do
private
def rdf_resource
@rdf_resource ||= Ldp::Resource::RdfSource.new(ActiveFedora.fedora.build_ntriples_connection, uri)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment