Skip to content

Commit 684b0f7

Browse files
committed
refactor: ensure proper mutex handling in SendCommandTestCase
- Added a deferred unlock for the readMutex in the Run method of SendCommandTestCase to ensure that the mutex is always released, preventing potential deadlocks and improving thread safety.
1 parent 9eb30e4 commit 684b0f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/test_cases/send_command_test_case.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func (t *SendCommandTestCase) Run(client *resp_client.RespConnection, logger *lo
4242
}
4343

4444
t.readMutex.Lock()
45+
defer t.readMutex.Unlock()
4546
value, err = client.ReadValue()
46-
t.readMutex.Unlock()
4747

4848
if err != nil {
4949
return err

0 commit comments

Comments
 (0)