Update comments, exercise expiration codepath

I wanted to at least ensure my change's code was excerised, even though
it makes no material difference to the allStorageTests suite.
This commit is contained in:
Michael Xavier 2016-03-12 13:11:43 -08:00
parent 7d922d1de4
commit d135958be5
2 changed files with 5 additions and 3 deletions

View File

@ -288,7 +288,6 @@ insertSessionImpl sto session = do
let sk = rSessionKey sid
r <- batched (R.hmset sk) (printSession session)
expireSession session sto
-- Set the expiration if applicable
insertSessionForAuthId (sessionKey session) (sessionAuthId session)
return (() <$ r)
@ -307,7 +306,6 @@ replaceSessionImpl sto session = do
let sk = rSessionKey sid
_ <- R.del [sk]
r <- batched (R.hmset sk) (printSession session)
-- Set the expiration if applicable
expireSession session sto
-- Remove the old auth ID from the map if it has changed.
@ -328,6 +326,10 @@ throwRS
throwRS = liftIO . E.throwIO
-- | Given a session, finds the next time the session will time out,
-- either by idle or absolute timeout and schedule the key in redis to
-- expire at that time. This is meant to be used on every write to a
-- session so that it is constantly setting the appropriate timeout.
expireSession :: Session sess -> RedisStorage sess -> R.RedisTx ()
expireSession Session {..} RedisStorage {..} =
case minimum' (catMaybes [viaIdle, viaAbsolute]) of

View File

@ -10,4 +10,4 @@ main :: IO ()
main = do
conn <- connect defaultConnectInfo
hspec $ describe "RedisStorage" $
allStorageTests (RedisStorage conn Nothing Nothing) it runIO parallel shouldBe shouldReturn shouldThrow
allStorageTests (RedisStorage conn (Just 999999) (Just 999999)) it runIO parallel shouldBe shouldReturn shouldThrow