From 554fd7c7d0e8be0d0fb08cd019398c2a42145493 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 17 Jul 2014 16:03:53 +0100 Subject: [PATCH] change client connection timeout to 15 mins expire in redis --- .../Features/ConnectedUsers/ConnectedUsersManager.coffee | 2 +- .../coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee index 9c4fda7bf4..b3f18ec60f 100644 --- a/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee +++ b/services/web/app/coffee/Features/ConnectedUsers/ConnectedUsersManager.coffee @@ -11,7 +11,7 @@ ONE_HOUR_IN_S = 60 * 60 ONE_DAY_IN_S = ONE_HOUR_IN_S * 24 FOUR_DAYS_IN_S = ONE_DAY_IN_S * 4 -USER_TIMEOUT_IN_S = ONE_HOUR_IN_S +USER_TIMEOUT_IN_S = ONE_HOUR_IN_S / 4 buildProjectSetKey = (project_id)-> return "clients_in_project:#{project_id}" buildUserKey = (project_id, client_id)-> return "connected_user:#{project_id}:#{client_id}" diff --git a/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee b/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee index 605ea4fe04..bdba5cd2a6 100644 --- a/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/ConnectedUsers/ConnectedUsersManagerTests.coffee @@ -89,7 +89,7 @@ describe "ConnectedUsersManager", -> it "should add a ttl to the connected user so it stays clean", (done)-> @ConnectedUsersManager.markUserAsConnected @project_id, @client_id, @user, (err)=> - @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 60).should.equal true + @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 15).should.equal true done() describe "markUserAsDisconnected", -> @@ -160,6 +160,6 @@ describe "ConnectedUsersManager", -> it "should add the ttl on", (done)-> @ConnectedUsersManager.setUserCursorPosition @project_id, @client_id, @cursorData, (err)=> - @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 60).should.equal true + @rClient.expire.calledWith("connected_user:#{@project_id}:#{@client_id}", 60 * 15).should.equal true done()