Commit graph

7 commits

Author SHA1 Message Date
Dagur Valberg Johannsson
f421327a5d
Switch to tokio and sqlx
This makes the application fully async; freeing web server threads to
handle new connections when waiting on SQL queries.

Additionally sqlx will allow easier move to a different database if
needed in the future.

Includes some SQL optimizations as well (slow queries more easliy identifiable
with sqlx).
2026-02-18 10:16:51 +01:00
Dagur Valberg Johannsson
d85bc2c9db
Update copyright headers 2026-01-21 12:37:13 +01:00
Dagur Valberg Johannsson
e93d46ec69 Add Cache-Control headers to RPC endpoints for load balancer caching
Introduce CachedJson response wrapper with cache duration based on data mutability:
- CACHE_IMMUTABLE (1 day): historical data with explicit timestamps
- CACHE_BCMR (5 min): token metadata
- CACHE_AGGREGATE (60s): aggregate data that changes with blocks
- CACHE_NONE: real-time data (current price, active pools, latest txs)

Endpoints dynamically select cache duration based on whether time parameters
are explicitly provided (historical/immutable) or defaulted to now (live).
2026-01-21 10:37:55 +01:00
Dagur Valberg Johannsson
2c76bf09c7 Fix incorrect 5XX responses for user input errors
Return proper 4XX status codes for client errors to prevent load balancers
from misinterpreting input validation failures as server errors. Add
centralized ApiResult type and ApiErrorCode enum for consistent handling.
2026-01-21 08:27:57 +01:00
Dagur Valberg Johannsson
007aeb06dd
contrib: Tool for documenting API calls 2025-07-22 13:08:48 +02:00
Dagur Valberg Johannsson
7d9352cf53
Fix clippy issues 2025-07-16 13:52:46 +02:00
Dagur Valberg Johannsson
e4e7ec3b71
Add aggregated APY endpoint
Add an endpoint that gives a APY value across multiple micro-pools
2024-10-23 16:54:06 +02:00