Skip to content

refactor(memory): use parking_lot for the live-session map in session_limit - #2462

Merged
cyberlife-coder merged 3 commits into
developfrom
refactor/memory-session-limit-parking-lot
Oct 24, 2026
Merged

cyberlife-coder merged 3 commits into
developfrom
refactor/memory-session-limit-parking-lot

Conversation

@cyberlife-coder

@cyberlife-coder cyberlife-coder commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Description

Supersedes #2452, which cannot merge as it stands (non-conforming branch prefix and commit author). The original change is kept as is; #2452 stays open for its owner to close.

The HTTP session limiter's live-session map (crates/velesdb-memory/src/http/session_limit.rs) was the crate's one remaining std::sync::Mutex. It now uses parking_lot::Mutex, which does not poison, so the poison-recovery shim (PoisonError::into_inner) is gone, per the workspace lock policy (AGENTS.md). Behavior is unchanged. No guard is held across an .await (clippy::await_holding_lock is clean). CHANGELOG note under ### Changed in crates/velesdb-memory/CHANGELOG.md.

Addition on top of #2452: the comment above the parking_lot dependency in crates/velesdb-memory/Cargo.toml named only WORKING_INDEX_WRITE; it now also names the session limiter's live-session map.

Type of Change

  • 🔧 Refactoring (no functional changes)

How Has This Been Tested?

  • Unit tests

  • Integration tests

  • cargo test -p velesdb-memory --no-default-features --features http --lib session_limit -- --test-threads=1: 24 passed.

  • cargo test -p velesdb-memory --features http --test http_transport --test http_lock_contention: 16 + 1 passed.

  • cargo clippy -p velesdb-memory --all-targets -- -D warnings -D clippy::pedantic -D clippy::await_holding_lock, with --features http and with default features: clean.

  • cargo fmt -p velesdb-memory -- --check: clean.

  • scripts/check-doc-contract.sh, the five check-doc-freshness.py guards (strict), check-version-sync.py, check-mcp-doc-contract.py, check-promise-contract.py, check-feature-claims.py and check-ai-attribution.py origin/develop..HEAD: all pass.

Test Configuration:

  • OS: Linux
  • Rust version: stable (workspace toolchain)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (refactoring, covered by the existing session_limit, http_transport and http_lock_contention tests)
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

…_limit

The HTTP session limiter's live-session map was the crate's one remaining
std::sync::Mutex. parking_lot does not poison, so the poison-recovery shim
(PoisonError::into_inner) goes away, per the workspace lock policy; behavior
is unchanged. No guard is held across an await point (clippy
await_holding_lock is clean).

The comment on the parking_lot dependency in Cargo.toml named only
WORKING_INDEX_WRITE; it now names the session limiter too. CHANGELOG note
under Changed.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@cyberlife-coder
cyberlife-coder enabled auto-merge (squash) October 24, 2026 21:17
@cyberlife-coder
cyberlife-coder merged commit 21fdaab into develop Oct 24, 2026
74 checks passed
@cyberlife-coder
cyberlife-coder deleted the refactor/memory-session-limit-parking-lot branch October 24, 2026 22:15
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.

1 participant