diff options
author | David Hill <dhill@mindcry.org> | 2018-11-07 14:36:50 -0500 |
---|---|---|
committer | Wim <wim@42.be> | 2018-11-07 20:36:50 +0100 |
commit | 0e2522279e8671a345c1be6b8b07c0f1a505e23e (patch) | |
tree | 968ac4b1acd0352ae9962d6f71bfd7d9c668596f /bridge/slack/slack.go | |
parent | 141a42a75b47b0a05f5b360ff5711819d3727a75 (diff) | |
download | matterbridge-msglm-0e2522279e8671a345c1be6b8b07c0f1a505e23e.tar.gz matterbridge-msglm-0e2522279e8671a345c1be6b8b07c0f1a505e23e.tar.bz2 matterbridge-msglm-0e2522279e8671a345c1be6b8b07c0f1a505e23e.zip |
Clean up various stuff (#508)
* various cleanups
Diffstat (limited to 'bridge/slack/slack.go')
-rw-r--r-- | bridge/slack/slack.go | 20 |
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 } |