This repository was archived by the owner on Mar 9, 2025. It is now read-only.
File tree 2 files changed +12
-2
lines changed 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,10 @@ func (r *Router) DiscoveryAllBuckets(ctx context.Context) error {
261
261
}
262
262
263
263
bucketsDiscoveryPaginationFrom = resp .NextFrom
264
+
265
+ // Don't spam many requests at once. Give storages time to handle them and other requests.
266
+ // https://github.com/tarantool/vshard/blob/b6fdbe950a2e4557f05b83bd8b846b126ec3724e/vshard/router/init.lua#L308
267
+ time .Sleep (r .cfg .DiscoveryWorkStep )
264
268
}
265
269
})
266
270
}
Original file line number Diff line number Diff line change @@ -93,8 +93,9 @@ type Config struct {
93
93
94
94
// Discovery
95
95
// DiscoveryTimeout is timeout between cron discovery job; by default there is no timeout.
96
- DiscoveryTimeout time.Duration
97
- DiscoveryMode DiscoveryMode
96
+ DiscoveryTimeout time.Duration
97
+ DiscoveryWorkStep time.Duration
98
+ DiscoveryMode DiscoveryMode
98
99
99
100
// BucketsSearchMode defines policy for BucketDiscovery method.
100
101
// Default value is BucketsSearchLegacy.
@@ -234,6 +235,7 @@ func (r *Router) RouteMapClean() {
234
235
235
236
func prepareCfg (cfg Config ) (Config , error ) {
236
237
const discoveryTimeoutDefault = 1 * time .Minute
238
+ const discoveryWorkStepDefault = 10 * time .Millisecond
237
239
238
240
err := validateCfg (cfg )
239
241
if err != nil {
@@ -244,6 +246,10 @@ func prepareCfg(cfg Config) (Config, error) {
244
246
cfg .DiscoveryTimeout = discoveryTimeoutDefault
245
247
}
246
248
249
+ if cfg .DiscoveryWorkStep == 0 {
250
+ cfg .DiscoveryWorkStep = discoveryWorkStepDefault
251
+ }
252
+
247
253
if cfg .Loggerf == nil {
248
254
cfg .Loggerf = emptyLogfProvider
249
255
}
You can’t perform that action at this time.
0 commit comments