diff --git a/src/exits/utils.py b/src/exits/utils.py index a2cff437..d413d603 100644 --- a/src/exits/utils.py +++ b/src/exits/utils.py @@ -54,6 +54,9 @@ async def send_signature_rotation_request_to_replicas( ) -> OracleApproval: last_error = None + # Shuffling may help if the first endpoint is slower than others + replicas = random.sample(replicas, len(replicas)) + for endpoint in replicas: try: return await send_signature_rotation_request(session, endpoint, payload) diff --git a/src/validators/utils.py b/src/validators/utils.py index 5306a17b..682f005b 100644 --- a/src/validators/utils.py +++ b/src/validators/utils.py @@ -2,6 +2,7 @@ import dataclasses import json import logging +import random from multiprocessing import Pool from os import listdir from os.path import isfile, join @@ -90,6 +91,9 @@ async def send_approval_request_to_replicas( ) -> OracleApproval: last_error = None + # Shuffling may help if the first endpoint is slower than others + replicas = random.sample(replicas, len(replicas)) + for endpoint in replicas: try: return await send_approval_request(session, endpoint, payload)