Skip to content

Commit 5a6ea0a

Browse files
authored
feat(SQO): Implement RPC failover, retry logic and notification on RPC provider rotation. (#4)
* feat: Implement robust RPC failover and retry logic * Update config.toml.example * Add slack notifications for RPC rotation * Update README.md * mypy fix * Ruff * CI
1 parent 2845036 commit 5a6ea0a

File tree

9 files changed

+323
-282
lines changed

9 files changed

+323
-282
lines changed

.github/workflows/pr-check.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ jobs:
1818
fetch-depth: 0
1919

2020
- name: Validate PR requirements
21+
env:
22+
PR_TITLE: "${{ github.event.pull_request.title }}"
23+
PR_BODY: "${{ github.event.pull_request.body }}"
2124
run: |
22-
PR_TITLE="${{ github.event.pull_request.title }}"
23-
if [[ ${#PR_TITLE} -lt 1 ]]; then
25+
if [[ -z "$PR_TITLE" ]]; then
2426
echo "PR title cannot be empty"
2527
exit 1
2628
fi
2729
28-
PR_BODY="${{ github.event.pull_request.body }}"
29-
if [[ ${#PR_BODY} -lt 1 ]]; then
30+
if [[ -z "$PR_BODY" ]]; then
3031
echo "PR description cannot be empty"
3132
exit 1
3233
fi

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,15 @@ bandit -r src/
127127

128128
## TODO List (only outstanding TODOs)
129129

130-
### 1. Production Readiness
131-
- [ ] Check error recovery mechanisms to see if they could be improved (RPC failover, retry logic)
132-
- [ ] Verify health check endpoints or processes (Docker healthcheck)
133-
134-
### 2. Testing
130+
### 1. Testing
135131
- [ ] Create unit tests for all components
136132
- [ ] Create integration tests for the entire pipeline
137133
- [ ] Security review of code and dependencies
138134

139-
### 3. Documentation
135+
### 2. Documentation
140136
- [ ] Documentation of all major components
141137
- [ ] Document operational procedures
142138

143-
### 4. Optimization
139+
### 3. Optimization
144140
- [ ] Optimize dependencies and container setup
145-
- [ ] Ensure unused files, functions & dependencies are removed from codebase
141+
- [ ] Ensure unused files, functions & dependencies are removed from codebase

config.toml.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
# =============================================================================
77

88
[bigquery]
9-
BIGQUERY_LOCATION_ID = "US"
10-
BIGQUERY_PROJECT_ID = "graph-mainnet"
11-
BIGQUERY_DATASET_ID = "internal_metrics"
12-
BIGQUERY_TABLE_ID = "metrics_indexer_attempts"
9+
BIGQUERY_LOCATION_ID = ""
10+
BIGQUERY_PROJECT_ID = ""
11+
BIGQUERY_DATASET_ID = ""
12+
BIGQUERY_TABLE_ID = ""
1313

1414
[blockchain]
1515
BLOCKCHAIN_CONTRACT_ADDRESS = ""

scripts/ruff_check_format_assets.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ find src tests scripts -name "*.py" -print0 | xargs -0 python3 scripts/custom_fo
2828

2929
# Show remaining issues (mainly line length issues that need manual intervention)
3030
echo -e "\n\nRemaining issues that need manual attention:"
31-
ruff check src tests scripts --select E501 --statistics
31+
ruff check src tests scripts --select E501
3232

3333
echo "Linting/formatting complete! All auto-fixable issues have been resolved."
3434
echo "Manually review and fix any remaining line length issues if desired."

src/models/bigquery_data_access_provider.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import logging
6-
import socket
76
from datetime import date
87
from typing import cast
98

@@ -40,7 +39,7 @@ def __init__(
4039
self.max_blocks_behind = max_blocks_behind
4140

4241

43-
@retry_with_backoff(max_attempts=10, min_wait=1, max_wait=60, exceptions=(ConnectionError, socket.timeout))
42+
@retry_with_backoff(max_attempts=10, min_wait=1, max_wait=60)
4443
def _read_gbq_dataframe(self, query: str) -> DataFrame:
4544
"""
4645
Execute a read query on Google BigQuery and return the results as a pandas DataFrame.

0 commit comments

Comments
 (0)