LGTM, thanks.
On Thu, Jan 23, 2014 at 11:01 PM, Klaus Aehlig <[email protected]> wrote: > As luxid is taking over the handling of the job queue, it > also needs to handle the automated archiving of jobs. Here > we replicate the semantics of the current python implementation > of archiving as many jobs older than the given time as possible, > while not exceeding the given time out. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/Query/Server.hs | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs > index d3cea12..61c0256 100644 > --- a/src/Ganeti/Query/Server.hs > +++ b/src/Ganeti/Query/Server.hs > @@ -359,6 +359,17 @@ handleCall qlock _ cfg (ArchiveJob jid) = do > return . Ok $ showJSON True > else archiveFailed > > +handleCall qlock _ cfg (AutoArchiveJobs age timeout) = do > + qDir <- queueDir > + eitherJids <- getJobIDs [qDir] > + case eitherJids of > + Left s -> return . Bad . JobQueueError $ show s > + Right jids -> do > + result <- bracket_ (takeMVar qlock) (putMVar qlock ()) > + . archiveJobs cfg age timeout > + $ sortJobIDs jids > + return . Ok $ showJSON result > + > handleCall _ _ _ op = > return . Bad $ > GenericError ("Luxi call '" ++ strOfOp op ++ "' not implemented") > -- > 1.8.5.3 > >
