Skip to content

Move request initialisation outside of the lock - #4

Merged
fsdvh merged 1 commit into
masterfrom
small-update
Apr 29, 2026
Merged

fsdvh merged 1 commit into
masterfrom
small-update

Conversation

@fsdvh

@fsdvh fsdvh commented Apr 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • LockContention ergonomics: Added Clone, Copy, PartialEq, Eq, Hash derives so the error type can be compared, stored in sets/maps, and used in more contexts without surprise.
  • Performance fix in try_insert_with_lifecycle: Moved lifecycle.begin_request() to before the shard lock is acquired. Previously the lifecycle was initialized while holding the write lock; moving it outside avoids blocking other operations on the same shard during potentially expensive lifecycle setup.
  • Doc improvements: Clarified that lock contention is the only failure mode for try_insert / try_insert_with_lifecycle, and that inputs are returned so callers can retry or discard without data loss.

Test plan

  • Existing tests pass (cargo test)
  • test_try_insert and test_try_insert_with_lifecycle cover the non-blocking insert paths

🤖 Generated with Claude Code

@fsdvh
fsdvh merged commit c370c04 into master Apr 29, 2026
@fsdvh
fsdvh deleted the small-update branch April 29, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants