On Thu, 28 Jan 2016 at 18:49 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote:
> 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 > typo: latter > 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 > > LGTM, thanks -- Helga Velroyen Software Engineer [email protected] Google Germany GmbH Erika-Mann-Strasse 33 80636 München Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind, leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen Sie die E-Mail und alle Anhänge. Vielen Dank. This e-mail is confidential. If you are not the right addressee please do not forward it, please inform the sender, and please erase this e-mail including any attachments. Thanks.
