summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-18 11:10:03 -0400
committerGitHub <noreply@github.com>2016-07-18 11:10:03 -0400
commitc0ab2636d699c8544ce03a58f61b95cfd66ff7ce (patch)
treec7d07934e0ff1a75aafb097a184ae150888199c0 /api/context.go
parent180adc79af3d14de6ce62f6e687a6735db3fe82f (diff)
downloadchat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.tar.gz
chat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.tar.bz2
chat-c0ab2636d699c8544ce03a58f61b95cfd66ff7ce.zip
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
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go7
1 files changed, 2 insertions, 5 deletions
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 {