Ganeti updates its in-memory copy of the configuration in several ways. One of them is by using an inotify, the other is by periodically, in the order of seconds, polling the file. On the later, the inotify does not have to be reinstantiated; in fact, doing so will result in actions taken several times, once the inotify actually fires. Fix the fact, it was reinstantiated.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/ConfigReader.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Ganeti/ConfigReader.hs b/src/Ganeti/ConfigReader.hs index d5e9b81..4b034ad 100644 --- a/src/Ganeti/ConfigReader.hs +++ b/src/Ganeti/ConfigReader.hs @@ -172,14 +172,13 @@ safeUpdateConfig path oldfstat save_fn = -- | Long-interval reload watcher. -- -- This is on top of the inotify-based triggered reload. -onWatcherTimer :: IO Bool -> FilePath -> (Result ConfigData -> IO ()) +onWatcherTimer :: FilePath -> (Result ConfigData -> IO ()) -> MVar ServerState -> IO () -onWatcherTimer inotiaction path save_fn state = do +onWatcherTimer path save_fn state = do threadDelay watchInterval logDebug "Config-reader watcher timer fired" modifyMVar_ state (onWatcherInner path save_fn) - _ <- inotiaction - onWatcherTimer inotiaction path save_fn state + onWatcherTimer path save_fn state -- | Inner onWatcher handler. -- @@ -304,7 +303,7 @@ initConfigReader save_fn = do modifyMVar_ statemvar (\state -> return state { reloadModel = initialPoll }) -- fork the timeout timer - _ <- forkIO $ onWatcherTimer inotiaction conf_file save_fn statemvar + _ <- forkIO $ onWatcherTimer conf_file save_fn statemvar -- fork the polling timer unless has_inotify $ do _ <- forkIO $ onPollTimer inotiaction conf_file save_fn statemvar -- 2.7.0.rc3.207.g0ac5344
