added a maxTxArrivalWait constant to the fetcher. config params with longer durations than maxTxArrivalWait will default to the maxTxArrivalWait duration

This commit is contained in:
Alex 2023-04-04 23:20:07 -07:00
parent 070b13efbd
commit a5b49c313f

View file

@ -56,6 +56,10 @@ const (
// txGatherSlack is the interval used to collate almost-expired announces
// with network fetches.
txGatherSlack = 20 * time.Millisecond
// maxTxArrivalWait is the longest acceptable duration for the txArrivalWait
// configuration value. Longer config values will default to this.
maxTxArrivalWait = 500 * time.Millisecond
)
var (
@ -337,6 +341,11 @@ func (f *TxFetcher) Start() {
f.txArrivalWait = txGatherSlack
}
// the txArrivalWait duration should not be greater than the maxTxArrivalWait duration
if f.txArrivalWait > maxTxArrivalWait {
f.txArrivalWait = maxTxArrivalWait
}
go f.loop()
}