mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
chore: fix linter issues.
This commit is contained in:
@ -636,14 +636,6 @@ func loadTLSConfig(vault *vault.Vault) (*tls.Config, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func min(a, b time.Duration) time.Duration { //nolint:predeclared
|
|
||||||
if a < b {
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (bridge *Bridge) HasAPIConnection() bool {
|
func (bridge *Bridge) HasAPIConnection() bool {
|
||||||
return bridge.api.GetStatus() == proton.StatusUp
|
return bridge.api.GetStatus() == proton.StatusUp
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,8 @@ type CoolDownProvider interface {
|
|||||||
Reset()
|
Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
func jitter(max int) time.Duration { //nolint:predeclared
|
func jitter(maxValue int) time.Duration {
|
||||||
return time.Duration(rand.Intn(max)) * time.Second //nolint:gosec
|
return time.Duration(rand.Intn(maxValue)) * time.Second //nolint:gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExpCoolDown struct {
|
type ExpCoolDown struct {
|
||||||
|
|||||||
@ -231,7 +231,7 @@ func downloadAttachment(ctx context.Context, cache *DownloadCache, client APICli
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DownloadRateModifier interface {
|
type DownloadRateModifier interface {
|
||||||
Apply(wasSuccess bool, current int, max int) int //nolint:predeclared
|
Apply(wasSuccess bool, currentValue int, maxValue int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoDownloadRate[T any, R any](
|
func autoDownloadRate[T any, R any](
|
||||||
@ -285,14 +285,14 @@ func autoDownloadRate[T any, R any](
|
|||||||
|
|
||||||
type DefaultDownloadRateModifier struct{}
|
type DefaultDownloadRateModifier struct{}
|
||||||
|
|
||||||
func (d DefaultDownloadRateModifier) Apply(wasSuccess bool, current int, max int) int { //nolint:predeclared
|
func (d DefaultDownloadRateModifier) Apply(wasSuccess bool, currentValue int, maxValue int) int {
|
||||||
if !wasSuccess {
|
if !wasSuccess {
|
||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
parallelTasks := current * 2
|
parallelTasks := currentValue * 2
|
||||||
if parallelTasks > max {
|
if parallelTasks > maxValue {
|
||||||
parallelTasks = max
|
parallelTasks = maxValue
|
||||||
}
|
}
|
||||||
|
|
||||||
return parallelTasks
|
return parallelTasks
|
||||||
|
|||||||
Reference in New Issue
Block a user