fix: Use changed_at revision when updating fields (#778)

Setting the field's revision to `current_revision` when updating is not technically wrong, but its pessimizing.
If all previous reads only observed a change of up to `changed_at`, then it's fine for us to do the same as nothing
we derive from has read from `current_revision`.
This commit is contained in:
Lukas Wirth 2025-03-25 12:45:18 +01:00 committed by GitHub
parent 5ee3bdde58
commit 20a347e147
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -553,7 +553,7 @@ where
// to meet its safety invariant.
unsafe {
if C::update_fields(
current_revision,
current_deps.changed_at,
&mut data.revisions,
self.to_self_ptr(std::ptr::addr_of_mut!(data.fields)),
fields,
@ -568,7 +568,7 @@ where
}
}
if current_deps.durability < data.durability {
data.revisions = C::new_revisions(current_revision);
data.revisions = C::new_revisions(current_deps.changed_at);
data.created_at = current_revision;
}
data.durability = current_deps.durability;