-
-
Notifications
You must be signed in to change notification settings - Fork 37
Fix: lock #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: lock #165
Conversation
…dless of whether it exists or not - it always resolves the lock, you need to check for the existence of the key using the `has` method
…dless of whether it exists or not - it always resolves the lock, you need to check for the existence of the key using the `has` method
WalkthroughIntroduces an early-exit check in RoadRunnerLock::acquire to return false when the lock key already exists. Updates CHANGELOG to note that Spiral\RoadRunner\KeyValue\Cache now sets values unconditionally and always resolves the lock, requiring callers to check key existence via has(). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Lock as RoadRunnerLock
participant Store as KeyValue Storage
Caller->>Lock: acquire(key, ttl)
Lock->>Store: has(key)?
alt Key exists (early exit)
Store-->>Lock: true
Lock-->>Caller: false
else Key absent
Store-->>Lock: false
Lock->>Store: set(key, lockToken, ttl)
Store-->>Lock: set result (ok/fail)
alt set ok
Lock-->>Caller: true
else set failed
Lock-->>Caller: false
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (2)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.1.29)Path /fixes does not exist Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
The
Spiral\RoadRunner\KeyValue\Cacheclass will set the value regardless of whether it exists or not - it always resolves the lock, you need to check for the existence of the key using thehasmethodChecklist
CHANGELOG.mdfileSummary by CodeRabbit
Bug Fixes
Documentation