aboutsummaryrefslogtreecommitdiff
path: root/telegram/client.go
diff options
context:
space:
mode:
authorbodqhrohro <bodqhrohro@gmail.com>2019-12-30 08:01:56 +0300
committerbodqhrohro <bodqhrohro@gmail.com>2019-12-30 08:01:56 +0300
commit7ea5e9ac73199f264961e5d9845f302b41108e13 (patch)
tree6182672b64295a1672f216da556889e70b515c6b /telegram/client.go
parent307d5136d4e4eeee20591578bed237f58addab95 (diff)
Asynchronous message processing with guaranteed sequential per-chat delivery
Diffstat (limited to 'telegram/client.go')
-rw-r--r--telegram/client.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/telegram/client.go b/telegram/client.go
index dde15f2..7e7cdc8 100644
--- a/telegram/client.go
+++ b/telegram/client.go
@@ -55,6 +55,7 @@ type Client struct {
type clientLocks struct {
authorizationReady sync.WaitGroup
+ chatMessageLocks map[int64]*sync.Mutex
}
// NewClient instantiates a Telegram App
@@ -107,6 +108,8 @@ func NewClient(conf config.TelegramConfig, jid string, component *xmpp.Component
content: &conf.Content,
cache: cache.NewCache(),
options: options,
- locks: clientLocks{},
+ locks: clientLocks{
+ chatMessageLocks: make(map[int64]*sync.Mutex),
+ },
}, nil
}