In `RedisLockRepository.AcquireAsync`, the lock status is set to `Acquired` before the Redis SET NX operation:
```csharp
@lock.Status = Enums.LockStatus.Acquired; // Set before checking!
var success = await _database.StringSetAsync(key, value, expiry, When.NotExists);
```
If `StringSetAsync` returns `false` (lock already exists), the lock object's status is incorrectly set to `Acquired` even though acquisition failed. The caller receives `false` from the method but the lock object is in an inconsistent state.
Impact: Code that checks `@lock.Status` after a failed acquisition will incorrectly believe the lock was acquired.
Fix: Only set status to `Acquired` after confirming `success == true`.
Affected classes: `RedisLockRepository`
Affected file: `src/Backends/Redis/RedisLockRepository.cs`
In `RedisLockRepository.AcquireAsync`, the lock status is set to `Acquired` before the Redis SET NX operation:
```csharp
@lock.Status = Enums.LockStatus.Acquired; // Set before checking!
var success = await _database.StringSetAsync(key, value, expiry, When.NotExists);
```
If `StringSetAsync` returns `false` (lock already exists), the lock object's status is incorrectly set to `Acquired` even though acquisition failed. The caller receives `false` from the method but the lock object is in an inconsistent state.
Impact: Code that checks `@lock.Status` after a failed acquisition will incorrectly believe the lock was acquired.
Fix: Only set status to `Acquired` after confirming `success == true`.
Affected classes: `RedisLockRepository`
Affected file: `src/Backends/Redis/RedisLockRepository.cs`