/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/libkb/apiarg.go
53 строки
1 KB
chrisnojima
backport retry fixes from https://github.com/keybase/client/pull/29246 (#29251)
27 май 2026, 04:53
Не верифицирован
27 май 2026, 04:53
ecfd22f
Код
Авторство
О чём код?
package libkb import ( "net/url" "time" ) type APISessionType int const ( APISessionTypeNONE APISessionType = 0 APISessionTypeOPTIONAL APISessionType = 1 APISessionTypeREQUIRED APISessionType = 2 ) type APIHeader struct { Key string Value string } type APIArg struct { Endpoint string uArgs url.Values Args HTTPArgs JSONPayload JSONPayload SessionType APISessionType HTTPStatus []int AppStatusCodes []int InitialTimeout time.Duration // optional RetryMultiplier float64 // optional RetryCount int // optional UseText bool } // NewAPIArg creates a standard APIArg that will result // in one API request with the default timeout. func NewAPIArg(endpoint string) APIArg { return APIArg{ Endpoint: endpoint, } } // NewRetryAPIArg creates an APIArg that will cause the http client // to use a much smaller request timeout, but retry the request // several times, backing off on the timeout each time. func NewRetryAPIArg(endpoint string) APIArg { return APIArg{ Endpoint: endpoint, InitialTimeout: HTTPRetryInitialTimeout, RetryMultiplier: HTTPRetryMultiplier, RetryCount: HTTPRetryCount, } }