equal
deleted
inserted
replaced
22 ioref <- newIORef Map.empty |
22 ioref <- newIORef Map.empty |
23 return (JoinsMonitor ioref) |
23 return (JoinsMonitor ioref) |
24 |
24 |
25 |
25 |
26 cleanup :: JoinsMonitor -> UTCTime -> IO () |
26 cleanup :: JoinsMonitor -> UTCTime -> IO () |
27 cleanup (JoinsMonitor ref) time = modifyIORef' ref f |
27 cleanup (JoinsMonitor ref) time = modifyIORef ref f |
28 where |
28 where |
29 f = Map.mapMaybe (\v -> let v' = takeWhile (\t -> diffUTCTime time t < 60*60) v in if null v' then Nothing else Just v') |
29 f = Map.mapMaybe (\v -> let v' = takeWhile (\t -> diffUTCTime time t < 60*60) v in if null v' then Nothing else Just v') |
30 |
30 |
31 |
31 |
32 joinsSentry :: JoinsMonitor -> B.ByteString -> UTCTime -> IO Bool |
32 joinsSentry :: JoinsMonitor -> B.ByteString -> UTCTime -> IO Bool |