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

add caching for GET /rounds/current #143

Closed
wants to merge 1 commit into from
Closed

Conversation

juliangruber
Copy link
Member

@juliangruber juliangruber commented Nov 21, 2023

@juliangruber juliangruber requested a review from bajtos November 21, 2023 09:32
}
res.setHeader(
'cache-control',
`max-age=${roundParam === 'current' ? 60 : 31536000}}`
Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about a dynamic setting for the current round, which ensures it's not longer than the expected round end. Wdyt @bajtos?

Copy link
Member

Choose a reason for hiding this comment

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

This is a good idea.

In #147, I reworked "get tasks for the current round" logic so that we don't need dynamic max-age any more.

However, we should eventually move the logic of determining "what's the current meridian round index" from spark-api to spark-checker. I can imagine that it can be useful for spark-checker nodes to not start any new work (retrieval) if the current round is coming to an end.

By the time we finish the retrieval, submit the measurement to spark-api, and spark-publisher commits the measurement to Meridian, the new round will have already started, and our measurement will be evaluated as invalid (measuring a task that does not belong to this round).

I think we should make the check robust to handle changes in round lengths. Ideally, the smart contract should indicate when the current round is expected to end. I think we already have this value in Meridian state - the public field currentRoundEndBlockNumber.

I am proposing to open a new GH issue to track this idea. WDYT?

@juliangruber
Copy link
Member Author

Closing in favor of #147

@bajtos
Copy link
Member

bajtos commented Nov 22, 2023

After merging, adjust https://dash.cloudflare.com/37573110e38849a343d93b727953188f/filspark.com/caching/cache-rules/7cc5c26ebc3c400c9666c5a0f83ac50d to read the cache-control header again

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

2 participants