-
Notifications
You must be signed in to change notification settings - Fork 2
Ldp conflict during development
During development you will sometimes notice LDP::Conflict error.
This occurs because the model has been deleted in code or the model has been modified.
This is reported in https://github.com/samvera/hyrax/issues/3128
The fix for this is to open the rails console and mint new identifiers, but the minting process is stuck
$ bundle exec rails c
Inside the console type
[::Noid::Rails::Service.new.minter.mint, ::Noid::Rails::Service.new.minter.mint]
It should generate two new IDs. After this, restart you rails server, and the error should go away.
There is an initializer which will fix this issue - https://github.com/UCLALibrary/californica/pull/371, but the fix is not recommended for production. I created the file config/initializers/noid_rails.rb in my local dev. Haven't committed it as we don't want it in production. Also, this has been recently fixed in Hyrax, so we should get the fix on the next upgrade of Hyrax maybe.
# config/initializers/noid_rails.rb
# frozen_string_literal: true
# This is a fix for a bug in Hyrax where under certain circumstances the minter
# stops issuing new IDs, preventing new objects from being created. We encounter
# this sometimes when our ingest process crashes for some reason.
# See https://github.com/samvera/hyrax/issues/3128 for more details.
::Noid::Rails.config.identifier_in_use = lambda do |id|
ActiveFedora::Base.exists?(id) || ActiveFedora::Base.gone?(id)
end