Revision 01eea342 src/Ganeti/Confd/Server.hs

b/src/Ganeti/Confd/Server.hs
33 33

  
34 34
import Control.Concurrent
35 35
import Control.Exception
36
import Control.Monad (forever, liftM, when, unless)
36
import Control.Monad (forever, liftM, unless)
37 37
import Data.IORef
38 38
import Data.List
39 39
import qualified Data.Map as M
......
90 90

  
91 91
-- | Maximum no-reload poll rounds before reverting to inotify.
92 92
maxIdlePollRounds :: Int
93
maxIdlePollRounds = 2
93
maxIdlePollRounds = 3
94 94

  
95 95
-- | Reload timeout in microseconds.
96 96
configReloadTimeout :: Int
......
373 373
-- notification.
374 374
onReloadTimer :: IO Bool -> FilePath -> CRef -> MVar ServerState -> IO ()
375 375
onReloadTimer inotiaction path cref state = do
376
  threadDelay configReloadRatelimit
376 377
  logDebug "Reload timer fired"
377 378
  continue <- modifyMVar state (onReloadInner inotiaction path cref)
378
  when continue $
379
    do threadDelay configReloadRatelimit
380
       onReloadTimer inotiaction path cref state
381
  -- the inotify watch has been re-established, we can exit
379
  if continue
380
    then onReloadTimer inotiaction path cref state
381
    else logDebug "Inotify watch active, polling thread exiting"
382 382

  
383 383
-- | Inner onReload handler.
384 384
--

Also available in: Unified diff