Skip to content

Commit 9786cca

Browse files
committed
fix(testnet_cleanup): reduce random sleep duration to <0.5s
Reduced the random sleep duration from <1s to <0.5s in testnet_cleanup.py to prevent "Network.Socket.connect: <socket: 11>: resource exhausted" errors. This change aims to improve the efficiency of the cleanup process.
1 parent 1c9f47c commit 9786cca

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

cardano_node_tests/utils/testnet_cleanup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,14 @@ def _run(files: list[pl.Path]) -> None:
240240
skeys = []
241241
txins = []
242242
for fpath in files:
243-
# Add random sleep for < 1s to prevent
244-
# "Network.Socket.connect: <socket: 11>: resource exhausted"
245-
time.sleep(random.random())
246-
247243
f_name = fpath.name
248244
if f_name == "faucet.addr":
249245
continue
246+
247+
# Add random sleep for < 0.5s to prevent
248+
# "Network.Socket.connect: <socket: 11>: resource exhausted"
249+
time.sleep(random.random() / 2)
250+
250251
if f_name.endswith("_stake.addr"):
251252
payment_addr = fpath.parent / f_name.replace("_stake.addr", ".addr")
252253
try:
@@ -319,9 +320,9 @@ def cleanup_certs(
319320
addrs_queue.put(a)
320321

321322
def _run(cert_file: pl.Path, addrs_queue: queue.Queue[clusterlib.AddressRecord]) -> None:
322-
# Add random sleep for < 1s to prevent
323+
# Add random sleep for < 0.5s to prevent
323324
# "Network.Socket.connect: <socket: 11>: resource exhausted"
324-
time.sleep(random.random())
325+
time.sleep(random.random() / 2)
325326

326327
fname = cert_file.name
327328
fdir = cert_file.parent

0 commit comments

Comments
 (0)