Commit 6d5cede1 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Also clean up stale livelock files



So far, WConfD only cleans up the livelock files of resource
owners. While this is sufficient for reclaiming resources and
Ganeti to work properly, we still don't want to leak stale
livelock files.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarNiklas Hambuechen <niklash@google.com>
parent bd1d7b91
......@@ -78,4 +78,14 @@ cleanupLocksTask = forever . runResultT $ do
:: WConfdMonad (Either IOError ())
return ()
mapM_ cleanupIfDead owners
remainingFiles <- liftIO listLiveLocks
logDebug $ "Livelockfiles remaining: " ++ show remainingFiles
let cleanupStaleIfDead fpath = do
died <- liftIO (isDead fpath)
when died $ do
logInfo $ "Cleaning up stale file " ++ fpath
_ <- liftIO . E.try $ removeFile fpath
:: WConfdMonad (Either IOError ())
return ()
mapM_ cleanupStaleIfDead remainingFiles
liftIO $ threadDelay cleanupInterval
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment