Skip to content

Commit

Permalink
Revert "Try keeping the node dir in /tmp with separate NODE_DB"
Browse files Browse the repository at this point in the history
This reverts commit 25c7307.
  • Loading branch information
Anviking committed Oct 17, 2020
1 parent 43a5837 commit 6c9422b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .buildkite/bench-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ log=restore.log
results=restore-$network.txt
total_time=restore-time.txt

export NODE_DB=$HOME/node-db-$network
: "${NODE_DB:=$HOME/node-db-$network}"

echo "--- Build"

Expand Down
12 changes: 10 additions & 2 deletions lib/core-integration/src/Cardano/Wallet/BenchShared.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ import Options.Applicative
)
import Say
( sayErr )
import System.Directory
( createDirectoryIfMissing )
import System.Environment
( lookupEnv )
import System.FilePath
Expand Down Expand Up @@ -130,10 +132,16 @@ execBenchWithNode networkConfig action = do

withNetworkConfiguration :: RestoreBenchArgs -> (CardanoNodeConfig -> IO a) -> IO a
withNetworkConfiguration args action = do
-- Temporary directory for storing socket and node database
let withNodeDir cb = case argNodeDatabaseDir args of
Nothing -> withSystemTempDirectory "cw-node" cb
Just d -> do
createDirectoryIfMissing True d
cb d

let networkDir = argsNetworkDir args
port <- fromIntegral <$> getRandomPort
-- Temporary directory for storing socket
withSystemTempDirectory "cw-node" $ \dir -> action CardanoNodeConfig
withNodeDir $ \dir -> action CardanoNodeConfig
{ nodeDir = dir
, nodeConfigFile = networkDir </> "configuration.json"
, nodeDatabaseDir = fromMaybe "db" (argNodeDatabaseDir args)
Expand Down

0 comments on commit 6c9422b

Please sign in to comment.