MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / Done

Method Done

internal/task_group/group.go:57–82  ·  view source on GitHub ↗
(ctx context.Context, groupID string, success bool)

Source from the content-addressed store, hash-verified

55}
56
57func (tgc *TaskGroupCoordinator) Done(ctx context.Context, groupID string, success bool) {
58 tgc.mu.Lock()
59 defer tgc.mu.Unlock()
60 state, ok := tgc.groupStates[groupID]
61 if !ok || state.pending == 0 {
62 return
63 }
64 if success {
65 state.hasSuccess = true
66 }
67 logrus.Debugf("Done:%s ,state=%+v", groupID, state)
68 if state.pending == 1 {
69 payloads := tgc.groupPayloads[groupID]
70 delete(tgc.groupStates, groupID)
71 delete(tgc.groupPayloads, groupID)
72 if tgc.onCompletion != nil && state.hasSuccess {
73 logrus.Debugf("OnCompletion:%s", groupID)
74 tgc.mu.Unlock()
75 tgc.onCompletion(ctx, groupID, payloads...)
76 tgc.mu.Lock()
77 }
78 return
79 }
80 state.pending--
81 tgc.groupStates[groupID] = state
82}

Callers 15

SetRetryMethod · 0.45
BuildIndexFunction · 0.45
recursivelyListVirtualFunction · 0.45
OnSucceededMethod · 0.45
OnFailedMethod · 0.45
sendChunkTaskMethod · 0.45
downloadPartMethod · 0.45
delayMethod · 0.45
tryDownloadChunkMethod · 0.45
ShutdownFunction · 0.45
OnSucceededMethod · 0.45

Calls 1

UnlockMethod · 0.65

Tested by

no test coverage detected