обработка обновлений последовательно для каждого юзера благодаря mutex
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"example.com/m/adapter/backend"
|
||||
"github.com/NicoNex/echotron/v3"
|
||||
@@ -37,6 +38,7 @@ type Exec struct {
|
||||
|
||||
type Bot struct {
|
||||
echotron.API
|
||||
mu sync.Mutex
|
||||
ChatID int64
|
||||
exec *Exec
|
||||
CurrentState State
|
||||
@@ -205,6 +207,9 @@ func (b *Bot) SendMessageWithURLButton(text, buttonText, url string) {
|
||||
}
|
||||
|
||||
func (b *Bot) Update(u *echotron.Update) {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
log.Info().
|
||||
Int64("chat_id", b.ChatID).
|
||||
Str("current_state", fmt.Sprintf("%T", b.CurrentState)).
|
||||
|
||||
Reference in New Issue
Block a user