summaryrefslogtreecommitdiffstats
path: root/bridge/slack/helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/slack/helpers.go')
-rw-r--r--bridge/slack/helpers.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/bridge/slack/helpers.go b/bridge/slack/helpers.go
index 26a4748e..a03feb7b 100644
--- a/bridge/slack/helpers.go
+++ b/bridge/slack/helpers.go
@@ -65,6 +65,26 @@ func (b *Bslack) getChannelByID(ID string) (*slack.Channel, error) {
const minimumRefreshInterval = 10 * time.Second
+func (b *Bslack) populateUser(userID string) {
+ b.usersMutex.RLock()
+ _, exists := b.users[userID]
+ b.usersMutex.RUnlock()
+ if exists {
+ // already in cache
+ return
+ }
+
+ user, err := b.sc.GetUserInfo(userID)
+ if err != nil {
+ b.Log.Debugf("GetUserInfo failed for %v: %v", userID, err)
+ return
+ }
+
+ b.usersMutex.Lock()
+ b.users[userID] = user
+ b.usersMutex.Unlock()
+}
+
func (b *Bslack) populateUsers() {
b.refreshMutex.Lock()
if time.Now().Before(b.earliestUserRefresh) || b.refreshInProgress {