Skip to content

Commit

Permalink
feat: SaveBotChat() does not take Context anymore
Browse files Browse the repository at this point in the history
It is dangerous to allow user to pass context to this func as if it's a transactional context it might lead to deadlock
  • Loading branch information
trakhimenok committed Sep 14, 2024
1 parent 76f03b3 commit ff89c62
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions botsfw/webhook_context_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,9 @@ func (whcb *WebhookContextBase) CommandText(title, icon string) string {
return CommandTextNoTrans(title, icon)
}

func (whcb *WebhookContextBase) SaveBotChat(ctx context.Context) error {
return whcb.tx.Set(ctx, whcb.botChat.Record)
func (whcb *WebhookContextBase) SaveBotChat() error {
// It is dangerous to allow user to pass context to this func as if it's a transactional context it might lead to deadlock
return whcb.tx.Set(whcb.c, whcb.botChat.Record)
}

func (whcb *WebhookContextBase) SaveBotUser(ctx context.Context) error {
Expand Down

0 comments on commit ff89c62

Please sign in to comment.