mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
gf -server: include grammar modification time in the info returned by /version
This commit is contained in:
@@ -162,8 +162,10 @@ handle logLn documentroot state0 cache execute1 stateVar
|
|||||||
-- "/start" ->
|
-- "/start" ->
|
||||||
"/parse" -> parse (decoded qs)
|
"/parse" -> parse (decoded qs)
|
||||||
"/version" -> do (c1,c2) <- PS.listPGFCache cache
|
"/version" -> do (c1,c2) <- PS.listPGFCache cache
|
||||||
let rel = map (makeRelative documentroot)
|
let rel = makeRelative documentroot
|
||||||
return $ ok200 (unlines (gf_version:"":rel c1++"":rel c2))
|
sh1 (path,t) = rel path++" "++show t
|
||||||
|
sh = map sh1
|
||||||
|
return $ ok200 (unlines (gf_version:"":sh c1++"":sh c2))
|
||||||
"/flush" -> do PS.flushPGFCache cache; return (ok200 "flushed")
|
"/flush" -> do PS.flushPGFCache cache; return (ok200 "flushed")
|
||||||
'/':rpath ->
|
'/':rpath ->
|
||||||
-- This code runs without mutual exclusion, so it must *not*
|
-- This code runs without mutual exclusion, so it must *not*
|
||||||
|
|||||||
@@ -38,11 +38,13 @@ expireCache age c =
|
|||||||
performGC
|
performGC
|
||||||
|
|
||||||
-- | List currently cached files
|
-- | List currently cached files
|
||||||
listCache :: Cache a -> IO [FilePath]
|
listCache :: Cache a -> IO [(FilePath,UTCTime)]
|
||||||
listCache c =
|
listCache c =
|
||||||
fmap (mapMaybe id) . mapM check . Map.toList =<< readMVar (cacheObjects c)
|
fmap (mapMaybe id) . mapM check . Map.toList =<< readMVar (cacheObjects c)
|
||||||
where
|
where
|
||||||
check (path,v) = maybe Nothing (const (Just path)) `fmap` readMVar v
|
check (path,v) = maybe Nothing (Just . (,) path . fst3) `fmap` readMVar v
|
||||||
|
|
||||||
|
fst3 (x,y,z) = x
|
||||||
|
|
||||||
-- | Lookup a cached object (or read the file if it is not in the cache or if
|
-- | Lookup a cached object (or read the file if it is not in the cache or if
|
||||||
-- it has been modified)
|
-- it has been modified)
|
||||||
|
|||||||
Reference in New Issue
Block a user