Do not send archive commands if there is no active contract (#14978)

* do not send archive commands if there is no active contract

CHANGELOG_BEGIN
CHANGELOG_END

* use null instead of == []

CHANGELOG_BEGIN
CHANGELOG_END

* mis-spelling correction.

* let me try

* let me try again
This commit is contained in:
Chun Lok Ling 2022-09-09 17:52:32 +01:00 committed by GitHub
parent 5f22b9638b
commit 15c0610d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -501,8 +501,7 @@ reset args = do
(L.Verbosity False)
let chunks = chunksOf 100 activeContracts
forM_ chunks $ \chunk -> do
cmdId <- liftIO UUID.nextRandom
let cmds =
let cmds cmdId =
L.Commands
{ coms =
[ L.ExerciseCommand
@ -525,10 +524,13 @@ reset args = do
, minLeTimeRel = Nothing
, sid = Nothing
}
errOrEmpty <- L.submit cmds
case errOrEmpty of
Left err -> liftIO $ putStrLn $ "Failed to archive active contracts: " <> err
Right () -> pure ()
let noCommands = null [ x | (_offset, _mbWid, events) <- chunk, x <- events ]
unless noCommands $ do
cmdId <- liftIO UUID.nextRandom
errOrEmpty <- L.submit $ cmds cmdId
case errOrEmpty of
Left err -> liftIO $ putStrLn $ "Failed to archive active contracts: " <> err
Right () -> pure ()
HttpJson ->
fail
"The reset command is currently not available for the HTTP JSON API. Please use the gRPC API."