Skip to content

fix: avoid binding loop for invalid cache keys#740

Open
BobTheBuidler wants to merge 4 commits intoaio-libs:masterfrom
BobTheBuidler:fix-loop-affinity-key-order-20260218
Open

fix: avoid binding loop for invalid cache keys#740
BobTheBuidler wants to merge 4 commits intoaio-libs:masterfrom
BobTheBuidler:fix-loop-affinity-key-order-20260218

Conversation

@BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented Feb 18, 2026

Summary

  • Prevent invalid (unhashable) keys from binding loop affinity
  • Keep loop check after a valid key lookup

Rationale

Unhashable keys should raise TypeError without permanently binding the cache to the current event loop.

Details

  • Compute key, perform cache lookup, then check loop
  • Add test for invalid key not binding loop

Tests: python -m pytest

Fixes #739

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.42%. Comparing base (c0f36c4) to head (d395972).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #740      +/-   ##
==========================================
+ Coverage   97.37%   97.42%   +0.04%     
==========================================
  Files          15       15              
  Lines         991     1008      +17     
  Branches       56       56              
==========================================
+ Hits          965      982      +17     
  Misses         23       23              
  Partials        3        3              
Flag Coverage Δ
unit 96.32% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 18, 2026

Merging this PR will improve performance by ×15

⚡ 1 improved benchmark
✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_cache_hit_benchmark[func-bounded-ttl] 81.4 ms 5.3 ms ×15

Comparing BobTheBuidler:fix-loop-affinity-key-order-20260218 (d395972) with master (c0f36c4)2

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (c6acbe8) during the generation of this report, so c0f36c4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

fix: avoid binding loop affinity on invalid cache key inputs

1 participant

Comments