Skip to content

Commit 17691e4

Browse files
feat: add retry mechanism for certificate registration on Solana and include retry library in requirements
1 parent 4c61fee commit 17691e4

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

certified_builder/certificates_on_solana.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import httpx
3+
from retry import retry
34
from pydantic import BaseModel
45
from config import config
56

@@ -14,12 +15,14 @@ def __init__(self, message: str = "Error registering certificate on Solana",
1415
super().__init__(message)
1516
self.details = details
1617
self.cause = cause
18+
1719
class CertificatesOnSolana:
1820

1921
"""
2022
A class to manage certificates on the Solana blockchain Service."""
2123

2224
@staticmethod
25+
@retry(tries=3, delay=3, backoff=2, exceptions=(httpx.RequestError,CertificatesOnSolanaException, Exception), logger=logger)
2326
def register_certificate_on_solana(certificate_data: dict) -> dict:
2427
logger.info("Registering certificate on Solana blockchain with data: %s", certificate_data)
2528
"""

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ sniffio==1.3.1
2626
typing_extensions==4.12.2
2727
urllib3==2.3.0
2828
qrcode==8.2
29+
retry==0.9.2

0 commit comments

Comments
 (0)