MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / maybeDrain

Method maybeDrain

agent/tools_executor.go:309–336  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

307 defer e.mu.Unlock()
308 return e.slots[tcID]
309}
310
311func (e *StreamingToolExecutor) GetSlotInfo(toolUseID string) SlotInfo {
312 return e.GetSlot(toolUseID)
313}
314
315func (e *StreamingToolExecutor) Cancelled() bool {
316 select {
317 case <-e.cancelCtx.Done():
318 return true
319 default:
320 return false
321 }
322}
323
324func (e *StreamingToolExecutor) maybeDrain() {
325 var toLaunch []string
326 e.mu.Lock()
327 if e.Cancelled() {
328 e.mu.Unlock()
329 return
330 }
331 for _, tid := range e.toolOrder {
332 slot := e.slots[tid]
333 if slot != nil && slot.State == ToolStateQueued && e.isSafeLocked(slot.TC) && e.canStartImmediatelyLocked(slot.TC, false) {
334 toLaunch = append(toLaunch, tid)
335 }
336 }
337 for _, tid := range e.toolOrder {
338 slot := e.slots[tid]
339 if slot == nil || slot.State != ToolStateQueued || e.isSafeLocked(slot.TC) || !slot.PermissionGranted {

Callers 3

WaitForActivityMethod · 0.95
GetRemainingResultsMethod · 0.95
executeOneMethod · 0.95

Calls 4

CancelledMethod · 0.95
isSafeLockedMethod · 0.95
launchMethod · 0.95

Tested by

no test coverage detected