As described in #48, the update operation that updates the index document's last link may occasionally fail. When that happens, the last link becomes stale; it still points to an existing document, but no longer the last document (meaning: the newest document).
Subsequent write operations should attempt to detect this situation and remedy the situation.
Specifically, when AtomEventObserver<T>.OnNext or AtomEventObserver<T>.AppendAsync is invoked, it should check that the index document's last link points to a document that has no next link. If the document pointed to has a next link, it means that the last link points to a document that's no longer the last document. In this case, the method should recursively follow all next links until it finds a document that has no next link. This is the current last document, and the index document's last link should be updated with the address of that current last document.
Perhaps it may make sense to do this after completing #96. Also, the implementation for finding the true last document may be reused from the implementation of #97.
As described in #48, the update operation that updates the index document's last link may occasionally fail. When that happens, the last link becomes stale; it still points to an existing document, but no longer the last document (meaning: the newest document).
Subsequent write operations should attempt to detect this situation and remedy the situation.
Specifically, when
AtomEventObserver<T>.OnNext
orAtomEventObserver<T>.AppendAsync
is invoked, it should check that the index document's last link points to a document that has no next link. If the document pointed to has a next link, it means that the last link points to a document that's no longer the last document. In this case, the method should recursively follow all next links until it finds a document that has no next link. This is the current last document, and the index document's last link should be updated with the address of that current last document.Perhaps it may make sense to do this after completing #96. Also, the implementation for finding the true last document may be reused from the implementation of #97.