change client connection timeout to 15 mins expire in redis

This commit is contained in:
Henry Oswald 2014-07-17 16:03:53 +01:00
parent 478910a3aa
commit 554fd7c7d0
2 changed files with 3 additions and 3 deletions

View file

@ -11,7 +11,7 @@ ONE_HOUR_IN_S = 60 * 60
ONE_DAY_IN_S = ONE_HOUR_IN_S * 24 ONE_DAY_IN_S = ONE_HOUR_IN_S * 24
FOUR_DAYS_IN_S = ONE_DAY_IN_S * 4 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}" buildProjectSetKey = (project_id)-> return "clients_in_project:#{project_id}"
buildUserKey = (project_id, client_id)-> return "connected_user:#{project_id}:#{client_id}" buildUserKey = (project_id, client_id)-> return "connected_user:#{project_id}:#{client_id}"

View file

@ -89,7 +89,7 @@ describe "ConnectedUsersManager", ->
it "should add a ttl to the connected user so it stays clean", (done)-> it "should add a ttl to the connected user so it stays clean", (done)->
@ConnectedUsersManager.markUserAsConnected @project_id, @client_id, @user, (err)=> @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() done()
describe "markUserAsDisconnected", -> describe "markUserAsDisconnected", ->
@ -160,6 +160,6 @@ describe "ConnectedUsersManager", ->
it "should add the ttl on", (done)-> it "should add the ttl on", (done)->
@ConnectedUsersManager.setUserCursorPosition @project_id, @client_id, @cursorData, (err)=> @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() done()