Skip to content

Commit a8ff5e4

Browse files
authored
Merge pull request #196 from BoostryJP/fix/#194
fix: Add error handling when quorum terminating
2 parents 5165316 + ccce9c7 commit a8ff5e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/utils/web3_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import threading
2121
from typing import Any
2222
import time
23+
from json.decoder import JSONDecodeError
2324

2425
from sqlalchemy import create_engine
2526
from sqlalchemy.orm import Session
@@ -111,7 +112,8 @@ def make_request(self, method: RPCEndpoint, params: Any) -> RPCResponse:
111112
# Call RPC method
112113
try:
113114
return super().make_request(method, params)
114-
except ConnectionError:
115+
except (ConnectionError, JSONDecodeError):
116+
# NOTE: JSONDecodeError occurs when a request is sent during the termination process of Quorum.
115117
counter += 1
116118
if counter <= WEB3_REQUEST_RETRY_COUNT:
117119
time.sleep(WEB3_REQUEST_WAIT_TIME)

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ boto3==1.17.12
1212
alembic==1.5.6
1313
PyMySQL==1.0.2
1414
pytz==2021.1
15-
shared-memory-dict==0.5.0
15+
shared-memory-dict==0.5.0
16+
requests==2.25.1

0 commit comments

Comments
 (0)