Skip to content

Commit

Permalink
feat(loadtest): add ShardCongestedError
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 committed May 31, 2024
1 parent f161e54 commit 52ef5aa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pytest/tests/loadtest/locust/common/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,19 @@ 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):

Expand Down Expand Up @@ -673,6 +686,8 @@ 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 52ef5aa

Please sign in to comment.