fix: resolve all golangci-lint errors
Some checks failed
CI/CD / Test (push) Successful in 29s
CI/CD / Lint (push) Successful in 39s
CI/CD / Generate SBOM (push) Successful in 16s
CI/CD / Build (darwin-amd64) (push) Successful in 21s
CI/CD / Build (linux-amd64) (push) Successful in 20s
CI/CD / Build (darwin-arm64) (push) Successful in 21s
CI/CD / Build (linux-arm64) (push) Successful in 21s
CI/CD / Build & Push Docker Image (push) Failing after 4s
CI/CD / Release (push) Has been skipped
Some checks failed
CI/CD / Test (push) Successful in 29s
CI/CD / Lint (push) Successful in 39s
CI/CD / Generate SBOM (push) Successful in 16s
CI/CD / Build (darwin-amd64) (push) Successful in 21s
CI/CD / Build (linux-amd64) (push) Successful in 20s
CI/CD / Build (darwin-arm64) (push) Successful in 21s
CI/CD / Build (linux-arm64) (push) Successful in 21s
CI/CD / Build & Push Docker Image (push) Failing after 4s
CI/CD / Release (push) Has been skipped
- Add error checks for w.Write, json.Encode, os.MkdirAll, os.WriteFile, file.Seek
- Fix gosimple S1000: use for range instead of for { select {} }
- Fix ineffectual assignments in adaptive_io.go
- Add nolint directives for unused code intended for future use
- Fix SA1029: use custom contextKey type instead of string
- Fix SA9003: remove empty branch in client_network_handler.go
- All linting checks now pass
This commit is contained in:
@@ -388,11 +388,8 @@ func (m *NetworkResilienceManager) monitorNetworkQuality() {
|
||||
|
||||
log.Info("Starting network quality monitoring")
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
m.updateNetworkQuality()
|
||||
}
|
||||
for range ticker.C {
|
||||
m.updateNetworkQuality()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,27 +626,24 @@ func (m *NetworkResilienceManager) monitorNetworkChanges() {
|
||||
// Get initial interface state
|
||||
m.lastInterfaces, _ = net.Interfaces()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
currentInterfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
log.Warnf("Failed to get network interfaces: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if m.hasNetworkChanges(m.lastInterfaces, currentInterfaces) {
|
||||
log.Info("Network change detected")
|
||||
m.PauseAllUploads()
|
||||
|
||||
// Wait for network stabilization
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
m.ResumeAllUploads()
|
||||
}
|
||||
|
||||
m.lastInterfaces = currentInterfaces
|
||||
for range ticker.C {
|
||||
currentInterfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
log.Warnf("Failed to get network interfaces: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if m.hasNetworkChanges(m.lastInterfaces, currentInterfaces) {
|
||||
log.Info("Network change detected")
|
||||
m.PauseAllUploads()
|
||||
|
||||
// Wait for network stabilization
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
m.ResumeAllUploads()
|
||||
}
|
||||
|
||||
m.lastInterfaces = currentInterfaces
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user