Skip to content

Commit

Permalink
Update get_blocks.py (#34)
Browse files Browse the repository at this point in the history
Adjusted caching max-age for blocks
  • Loading branch information
supertypo authored Oct 2, 2023
1 parent 1fc94bd commit 40fdccd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions endpoints/get_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def get_block(response: Response,
# Still did not get the block
print("hier")
raise HTTPException(status_code=404, detail="Block not found", headers={
"Cache-Control": "public, max-age=3"
"Cache-Control": "public, max-age=1"
})

# We found the block, now we guarantee it contains the transactions
Expand All @@ -96,10 +96,10 @@ async def get_block(response: Response,
requested_block['transactions'] = await get_block_transactions(blockId)

if int(requested_block["header"]["blueScore"]) > current_blue_score_data["blue_score"] - 20:
response.headers["Cache-Control"] = "public, max-age=3"
response.headers["Cache-Control"] = "public, max-age=1"

elif int(requested_block["header"]["blueScore"]) > current_blue_score_data["blue_score"] - 60:
response.headers["Cache-Control"] = "public, max-age=60"
response.headers["Cache-Control"] = "public, max-age=10"

else:
response.headers["Cache-Control"] = "public, max-age=600"
Expand Down

0 comments on commit 40fdccd

Please sign in to comment.