Skip to content

Commit

Permalink
Adjust the per-chat request rate
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoNex committed May 20, 2024
1 parent 1ddff9f commit a3c3010
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ type client struct {
gl *rate.Limiter // global limiter
}

const (
globalRateLimit = 30
)

var lclient = newClient()

func newClient() client {
Expand All @@ -63,7 +59,7 @@ func (c client) wait(chatID string) error {
// If no limiter exists for a chat, create one.
l, ok := c.cl[chatID]
if !ok {
l = rate.NewLimiter(rate.Every(time.Minute/20), 10)
l = rate.NewLimiter(rate.Every(time.Minute/20), 1)
c.cl[chatID] = l
}

Expand Down Expand Up @@ -336,7 +332,3 @@ func (c client) sendStickers(url string, stickers ...InputSticker) (res []byte,
}
return c.doGet(url)
}

func isGroup(chatID string) bool {
return strings.HasPrefix(chatID, "-")
}

0 comments on commit a3c3010

Please sign in to comment.