Skip to content

Commit

Permalink
Update network limieter values
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoNex committed May 19, 2024
1 parent 584d75d commit 1ddff9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var (
locationTmp *Message
inviteTmp *ChatInviteLink
filePath string
currentBotName string
currentBotDesc string
msgThreadID int64
currentBotName = "bot name unset"
api = NewAPI("1713461126:AAEV5sgVo513Vz4PT33mpp0ZykJqrnSluzM")
chatID = int64(14870908)
banUserID = int64(41876271)
Expand Down
8 changes: 2 additions & 6 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func newClient() client {
return client{
Client: &http.Client{},
cl: make(map[string]*rate.Limiter),
gl: rate.NewLimiter(rate.Every(time.Second), 30),
gl: rate.NewLimiter(rate.Every(time.Second/30), 10),
}
}

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

Expand Down

0 comments on commit 1ddff9f

Please sign in to comment.