mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-02 02:10:45 +01:00
comment
This commit is contained in:
1 parent
bc7e015a41
commit
63b3a10535
1 file changed
+4
-2
@@ -344,9 +344,11 @@ func (bc *BrokerClient) ReadRecordsFromOffset(ctx context.Context, session *Brok
|
||||
key := session.Key()
|
||||
session.mu.Unlock()
|
||||
|
||||
// Close the old session completely
|
||||
// CRITICAL FIX: Acquire the global lock FIRST, then re-check the session offset
|
||||
// This prevents multiple threads from all deciding to recreate based on stale data
|
||||
bc.subscribersLock.Lock()
|
||||
// CRITICAL: Double-check if another thread already recreated the session at the desired offset
|
||||
|
||||
// Double-check if another thread already recreated the session at the desired offset
|
||||
// This prevents multiple concurrent threads from all trying to recreate the same session
|
||||
if existingSession, exists := bc.subscribers[key]; exists {
|
||||
existingSession.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user