Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions internal/project/ata.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,24 +240,6 @@ func (ti *TypingsInstaller) invokeRoutineToInstallTypings(
packageNames []string,
success bool,
) {
ti.pendingRunRequestsMu.Lock()
pendingRequestsCount := len(ti.pendingRunRequests)
var nextRequest *PendingRequest
if pendingRequestsCount == 0 {
ti.inFlightRequestCount--
} else {
nextRequest = ti.pendingRunRequests[0]
if pendingRequestsCount == 1 {
ti.pendingRunRequests = nil
} else {
ti.pendingRunRequests = ti.pendingRunRequests[1:]
}
}
ti.pendingRunRequestsMu.Unlock()
if nextRequest != nil {
ti.invokeRoutineToInstallTypings(nextRequest)
}

if success {
p.Logf("ATA:: Installed typings %v", packageNames)
var installedTypingFiles []string
Expand Down Expand Up @@ -330,6 +312,24 @@ func (ti *TypingsInstaller) invokeRoutineToInstallTypings(
Status: core.IfElse(success, "Success", "Fail"),
}
}

ti.pendingRunRequestsMu.Lock()
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a defer statement immediately after acquiring the lock (e.g. 'ti.pendingRunRequestsMu.Lock(); defer ti.pendingRunRequestsMu.Unlock()') to improve code safety and clarity.

Suggested change
ti.pendingRunRequestsMu.Lock()
ti.pendingRunRequestsMu.Lock()
defer ti.pendingRunRequestsMu.Unlock()

Copilot uses AI. Check for mistakes.
pendingRequestsCount := len(ti.pendingRunRequests)
var nextRequest *PendingRequest
if pendingRequestsCount == 0 {
ti.inFlightRequestCount--
} else {
nextRequest = ti.pendingRunRequests[0]
if pendingRequestsCount == 1 {
ti.pendingRunRequests = nil
} else {
ti.pendingRunRequests = ti.pendingRunRequests[1:]
}
}
ti.pendingRunRequestsMu.Unlock()
if nextRequest != nil {
ti.invokeRoutineToInstallTypings(nextRequest)
}
},
)
}
Expand Down