Skip to content

Commit 1575c08

Browse files
Fixed deadlocks in redis.go
1 parent 7e3ef1c commit 1575c08

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

internal/session/redis.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ func (m *Manager) saveSessionRedis(session *Session) error {
1818
ctx := context.Background()
1919

2020
/* thread safety for the session */
21-
session.Mutex.Lock()
22-
defer session.Mutex.Unlock()
21+
// session.Mutex.Lock()
22+
// defer session.Mutex.Unlock()
2323

2424
/* session key for redis */
2525
key := fmt.Sprintf("session:%s", session.ID)
@@ -45,8 +45,8 @@ func (m *Manager) updateSessionExpiryRedis(session *Session) error {
4545
ctx := context.Background()
4646

4747
/* thread safety for the session */
48-
session.Mutex.Lock()
49-
defer session.Mutex.Unlock()
48+
// session.Mutex.Lock()
49+
// defer session.Mutex.Unlock()
5050

5151
/* create a key for Redis operation */
5252
key := fmt.Sprintf("session:%s", session.ID)
@@ -69,8 +69,8 @@ func (m *Manager) updateSessionStatusRedis(session *Session, status Status) erro
6969
ctx := context.Background()
7070

7171
/* thread safety for the session */
72-
session.Mutex.Lock()
73-
defer session.Mutex.Unlock()
72+
// session.Mutex.Lock()
73+
// defer session.Mutex.Unlock()
7474

7575
/* create a key for Redis operation */
7676
key := fmt.Sprintf("session:%s", session.ID)
@@ -90,8 +90,8 @@ func (m *Manager) saveTransactionResultsRedis(session *Session, txResult types.T
9090
ctx := context.Background()
9191

9292
/* thread safety for the session */
93-
session.Mutex.Lock()
94-
defer session.Mutex.Unlock()
93+
// session.Mutex.Lock()
94+
// defer session.Mutex.Unlock()
9595

9696
/* get the session ID */
9797
sessionID := session.ID
@@ -113,8 +113,8 @@ func (m *Manager) getTransactionResultsRedis(session *Session, limit int) ([]typ
113113
ctx := context.Background()
114114

115115
/* thread safety for the session */
116-
session.Mutex.Lock()
117-
defer session.Mutex.Unlock()
116+
// session.Mutex.Lock()
117+
// defer session.Mutex.Unlock()
118118

119119
/* get the session ID */
120120
sessionID := session.ID

0 commit comments

Comments
 (0)