From 20dfec4d88f728429dc2a3e5bdaebf01c3433f40 Mon Sep 17 00:00:00 2001 From: Paul Rouse Date: Fri, 8 Aug 2014 11:10:07 +0100 Subject: [PATCH] Revise previous fix (#799) to yesod devel timeout --- yesod-bin/Devel.hs | 2 +- yesod-bin/main.hs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index 67ec07ad..77f34286 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -388,7 +388,7 @@ watchForChanges filesModified hsSourceDirs extraFiles list t = do Map.differenceWith compareTimes newList list `Map.union` Map.differenceWith compareTimes list newList return (haskellFileChanged, newList) - else timeout (10000000*t) (takeMVar filesModified) >> + else timeout (1000000*t) (takeMVar filesModified) >> watchForChanges filesModified hsSourceDirs extraFiles list t where compareTimes x y diff --git a/yesod-bin/main.hs b/yesod-bin/main.hs index 2202fb54..ef1882d0 100755 --- a/yesod-bin/main.hs +++ b/yesod-bin/main.hs @@ -152,6 +152,9 @@ optParser = Options keterOptions :: Parser Command keterOptions = Keter <$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" ) +defaultRescan :: Int +defaultRescan = 10 + develOptions :: Parser Command develOptions = Devel <$> switch ( long "disable-api" <> short 'd' <> help "Disable fast GHC API rebuilding") @@ -159,8 +162,10 @@ develOptions = Devel <$> switch ( long "disable-api" <> short 'd' <> help "Run COMMAND after rebuild succeeds") <*> optStr ( long "failure-hook" <> short 'f' <> metavar "COMMAND" <> help "Run COMMAND when rebuild fails") - <*> option ( long "event-timeout" <> short 't' <> value 1 <> metavar "N" - <> help "Force rescan of files every N seconds" ) + <*> option ( long "event-timeout" <> short 't' <> value defaultRescan <> metavar "N" + <> help ("Force rescan of files every N seconds (default " + ++ show defaultRescan + ++ ", use -1 to rely on FSNotify alone)") ) <*> optStr ( long "builddir" <> short 'b' <> help "Set custom cabal build directory, default `dist'") <*> many ( strOption ( long "ignore" <> short 'i' <> metavar "DIR"