Skip to content

Commit

Permalink
feat(loadtest): add ShardCongestedError (near#11438)
Browse files Browse the repository at this point in the history
Display the error case for congested shards separately in the report.
  • Loading branch information
jakmeier authored Jun 4, 2024
1 parent 729d9e5 commit aad30b5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pytest/tests/loadtest/locust/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,20 @@ def __init__(
self.ak_nonce = ak_nonce


class ShardCongestedError(RpcError):

def __init__(
self,
shard_id,
):
super().__init__(
message="Shard congested",
details=
f"Shard {shard_id} is currently congested and rejects new transactions"
)
self.shard_id = shard_id


class TxError(NearError):

def __init__(self,
Expand Down Expand Up @@ -687,6 +701,9 @@ def evaluate_rpc_result(rpc_result):
raise InvalidNonceError(
err_description["InvalidNonce"]["tx_nonce"],
err_description["InvalidNonce"]["ak_nonce"])
elif "ShardCongested" in err_description:
raise ShardCongestedError(
err_description["ShardCongested"]["shard_id"])
raise RpcError(details=rpc_result["error"])

result = rpc_result["result"]
Expand Down

0 comments on commit aad30b5

Please sign in to comment.