use throttle from config
This commit is contained in:
parent
ac5b8b8287
commit
65f5edc83b
@ -20,4 +20,6 @@ type Config struct {
|
||||
AltPipeProtocolPrefix string `ini:"alt_pipe_protocol_prefix"`
|
||||
AltPipeProtocolSuffix string `ini:"alt_pipe_protocol_suffix"`
|
||||
NeighborsRefreshTimeout int `ini:"neighbors_refresh_timeout"`
|
||||
|
||||
StreamParserThrottle int
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ func parseRoutesResponseStream(
|
||||
meta := &api.Meta{}
|
||||
routes := api.Routes{}
|
||||
|
||||
throttle := time.Duration(config.StreamParserThrottle) * time.Nanosecond
|
||||
|
||||
for {
|
||||
t, err := dec.Token()
|
||||
if err == io.EOF {
|
||||
@ -68,7 +70,7 @@ func parseRoutesResponseStream(
|
||||
}
|
||||
|
||||
// Wait a bit, so our CPUs do not go up in flames.
|
||||
time.Sleep(30000 * time.Nanosecond)
|
||||
time.Sleep(throttle)
|
||||
|
||||
route := parseRouteData(rdata, config, false)
|
||||
routes = append(routes, route)
|
||||
|
Loading…
x
Reference in New Issue
Block a user