mirror of
https://github.com/openfaas/faas.git
synced 2025-06-10 01:06:47 +00:00
Update scaling polling interval
Polls every 100 ms instead of every 50ms for use with a new faas-netes PR: https://github.com/openfaas/faas-netes/pull/726 The call is much faster now, so this request should me made at a lower frequency. Also adds error handling for URL building in the external service query code. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
parent
3170d97bb5
commit
4ced7cacd0
@ -137,7 +137,7 @@ func main() {
|
|||||||
scalingConfig := scaling.ScalingConfig{
|
scalingConfig := scaling.ScalingConfig{
|
||||||
MaxPollCount: uint(1000),
|
MaxPollCount: uint(1000),
|
||||||
SetScaleRetries: uint(20),
|
SetScaleRetries: uint(20),
|
||||||
FunctionPollInterval: time.Millisecond * 50,
|
FunctionPollInterval: time.Millisecond * 100,
|
||||||
CacheExpiry: time.Second * 5, // freshness of replica values before going stale
|
CacheExpiry: time.Second * 5, // freshness of replica values before going stale
|
||||||
ServiceQuery: externalServiceQuery,
|
ServiceQuery: externalServiceQuery,
|
||||||
}
|
}
|
||||||
|
@ -63,14 +63,16 @@ func (s ExternalServiceQuery) GetReplicas(serviceName, serviceNamespace string)
|
|||||||
|
|
||||||
urlPath := fmt.Sprintf("%ssystem/function/%s?namespace=%s", s.URL.String(), serviceName, serviceNamespace)
|
urlPath := fmt.Sprintf("%ssystem/function/%s?namespace=%s", s.URL.String(), serviceName, serviceNamespace)
|
||||||
|
|
||||||
req, _ := http.NewRequest(http.MethodGet, urlPath, nil)
|
req, err := http.NewRequest(http.MethodGet, urlPath, nil)
|
||||||
|
if err != nil {
|
||||||
|
return emptyServiceQueryResponse, err
|
||||||
|
}
|
||||||
|
|
||||||
if s.AuthInjector != nil {
|
if s.AuthInjector != nil {
|
||||||
s.AuthInjector.Inject(req)
|
s.AuthInjector.Inject(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := s.ProxyClient.Do(req)
|
res, err := s.ProxyClient.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(urlPath, err)
|
log.Println(urlPath, err)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user