Skip to content

Commit

Permalink
OCT-1843: Refetch when getting 404 error (#411)
Browse files Browse the repository at this point in the history
## Description

## Definition of Done

1. [ ] Acceptance criteria are met.
2. [ ] PR is manually tested before the merge by developer(s).
    - [ ] Happy path is manually checked.
3. [ ] PR is manually tested by QA when their assistance is required
(1).
- [ ] Octant Areas & Test Cases are checked for impact and updated if
required (2).
4. [ ] Unit tests are added unless there is a reason to omit them.
5. [ ] Automated tests are added when required.
6. [ ] The code is merged.
7. [ ] Tech documentation is added / updated, reviewed and approved
(including mandatory approval by a code owner, should such exist for
changed files).
    - [ ] BE: Swagger documentation is updated.
8. [ ] When required by QA:
    - [ ] Deployed to the relevant environment.
    - [ ] Passed system tests.

---

(1) Developer(s) in coordination with QA decide whether it's required.
For small tickets introducing small changes QA assistance is most
probably not required.

(2) [Octant Areas & Test
Cases](https://docs.google.com/spreadsheets/d/1cRe6dxuKJV3a4ZskAwWEPvrFkQm6rEfyUCYwLTYw_Cc).
  • Loading branch information
kgarbacinski authored Sep 18, 2024
1 parent 785368a commit 16ac5ae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/app/infrastructure/external_api/common.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import time
from http import HTTPStatus
from typing import Callable, Dict

from app.exceptions import ExternalApiException


def retry_request(
req_func: Callable,
status_code: int,
status_code: HTTPStatus,
no_retries: int = 3,
sleep_time: int = 1,
**kwargs,
Expand Down
3 changes: 2 additions & 1 deletion backend/app/modules/multisig_signatures/service/offchain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from http import HTTPStatus
from typing import List, Dict

from app.context.manager import Context
Expand Down Expand Up @@ -101,7 +102,7 @@ def save_pending_signature(
def _verify_owner(self, user_address: str, message_hash: str):
message_details = retry_request(
req_func=get_message_details,
status_code=404,
status_code=HTTPStatus.NOT_FOUND,
message_hash=message_hash,
is_mainnet=self.is_mainnet,
)
Expand Down
4 changes: 3 additions & 1 deletion backend/app/modules/user/antisybil/service/initial.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from http import HTTPStatus

from flask import current_app as app

from eth_utils.address import to_checksum_address
Expand Down Expand Up @@ -52,7 +54,7 @@ def _retry_fetch():
raise ExternalApiException("GP: scoring is not completed yet", 503)

if score["status"] != "DONE":
score = retry_request(_retry_fetch, 200)
score = retry_request(_retry_fetch, HTTPStatus.OK)

all_stamps = fetch_stamps(user_address)["items"]
cutoff = datetime.now()
Expand Down

0 comments on commit 16ac5ae

Please sign in to comment.