summaryrefslogtreecommitdiffstats
path: root/bridge/slack/slack.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/slack/slack.go')
-rw-r--r--bridge/slack/slack.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 924f4131..c1386a46 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -5,6 +5,7 @@ import (
"fmt"
"strings"
"sync"
+ "time"
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
@@ -34,6 +35,11 @@ type Bslack struct {
channelsByID map[string]*slack.Channel
channelsByName map[string]*slack.Channel
channelsMutex sync.RWMutex
+
+ refreshInProgress bool
+ earliestChannelRefresh time.Time
+ earliestUserRefresh time.Time
+ refreshMutex sync.Mutex
}
const (
@@ -68,12 +74,14 @@ func New(cfg *bridge.Config) bridge.Bridger {
cfg.Log.Fatalf("Could not create LRU cache for Slack bridge: %v", err)
}
b := &Bslack{
- Config: cfg,
- uuid: xid.New().String(),
- cache: newCache,
- users: map[string]*slack.User{},
- channelsByID: map[string]*slack.Channel{},
- channelsByName: map[string]*slack.Channel{},
+ Config: cfg,
+ uuid: xid.New().String(),
+ cache: newCache,
+ users: map[string]*slack.User{},
+ channelsByID: map[string]*slack.Channel{},
+ channelsByName: map[string]*slack.Channel{},
+ earliestChannelRefresh: time.Now(),
+ earliestUserRefresh: time.Now(),
}
return b
}