Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stability #5

Merged
merged 1 commit into from
Aug 2, 2024
Merged

Stability #5

merged 1 commit into from
Aug 2, 2024

Conversation

kongzii
Copy link
Collaborator

@kongzii kongzii commented Aug 2, 2024

No description provided.

market = OmenSubgraphHandler().get_omen_market_by_market_id(market_id)
except ValueError:
raise fastapi.HTTPException(
status_code=404, detail=f"Market with id `{market_id}` not found."
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fastapi will handle 404 error correctly, instead of breaking the whole pod

try:
insights = tavily_insights(market.question_title)
except Exception as e:
logger.error(f"Failed to get insights for market `{market_id}`: {e}")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is some problem with Tavily, trigger alert for us, but return empty results for them, to not break frontend.

fastapi.Query(
...,
description="Hex address of the market on Omen.",
pattern="^0x[a-fA-F0-9]{40}$",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some basic validation of market's id, to not accept arbitrary strings.

@kongzii kongzii merged commit e449756 into main Aug 2, 2024
6 checks passed
@kongzii kongzii deleted the peter/stability branch August 2, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants