From c0ab2636d699c8544ce03a58f61b95cfd66ff7ce Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 18 Jul 2016 11:10:03 -0400 Subject: PLT-2241 Refactored statuses into a more real-time system (#3573) * Refactored statuses into a more real-time system * Updated package.json with correct commit and fixed minor bug * Minor updates to statuses based on feedback * When setting status online, update only LastActivityAt if status already exists --- api/context.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index 93ff83247..2132ce0e7 100644 --- a/api/context.go +++ b/api/context.go @@ -20,6 +20,7 @@ import ( ) var sessionCache *utils.Cache = utils.NewLru(model.SESSION_CACHE_SIZE) +var statusCache *utils.Cache = utils.NewLru(model.STATUS_CACHE_SIZE) var allowedMethods []string = []string{ "POST", @@ -196,11 +197,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if c.Err == nil && h.isUserActivity && token != "" && len(c.Session.UserId) > 0 { - go func() { - if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil { - l4g.Error(utils.T("api.context.last_activity_at.error"), c.Session.UserId, c.Session.Id, err) - } - }() + SetStatusOnline(c.Session.UserId, c.Session.Id) } if c.Err == nil { -- cgit v1.2.3-1-g7c22