discovery: introduce rate limiter to GossipSyncer

This commit is contained in:
yyforyongyu committed 2025-09-02 21:13:46 +08:00
1 parent 19bc941cbd
commit 6826703c77
2 files changed
+29 -2

No files matched your search

+5
View File
@@ -40,6 +40,11 @@ const (
// they'll be refilled at this rate.
DefaultMsgBytesPerSecond = 1000 * 1_024
// DefaultPeerMsgBytesPerSecond is the max bytes/s we'll permit for
// outgoing messages for a single peer. Once tokens (bytes) have been
// taken from the bucket, they'll be refilled at this rate.
DefaultPeerMsgBytesPerSecond = 50 * 1_024
// assumedMsgSize is the assumed size of a message if we can't compute
// its serialized size. This comes out to 1 KB.
assumedMsgSize = 1_024