Commit f7819050 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Release internal lock for serial file later

When allocating new jobs, the new serial is replicated among
all master candidates. To avoid races with a later job id
allocation, keep the internal lock till after the replication
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent 9d049fb4
......@@ -374,15 +374,16 @@ allocateJobIds mastercandidates lock n =
serial <- jobQueueSerialFile
write_result <- try $ atomicWriteFile serial serial_content
:: IO (Either IOError ())
putMVar lock ()
case write_result of
Left e -> do
putMVar lock ()
let msg = "Failed to write serial file: " ++ show e
logError msg
return . Bad $ msg
Right () -> do
_ <- executeRpcCall mastercandidates
$ RpcCallJobqueueUpdate serial serial_content
putMVar lock ()
return $ mapM makeJobId [(current+1)..(current+n)]
-- | Allocate one new job id.
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