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

Transaction ID for requests #137

Open
applejag opened this issue Feb 2, 2022 · 0 comments
Open

Transaction ID for requests #137

applejag opened this issue Feb 2, 2022 · 0 comments
Labels
enhancement New feature or request prio/0 Lowest priority. "Wishful thinking"

Comments

@applejag
Copy link
Contributor

applejag commented Feb 2, 2022

This is only in the idea phase, but would want a way to make HTTP POST requests idempotent, allowing for retry logic.

There's this somewhat conventional usage of the X-Request-ID header that can be used to provide idempotency on any request, given that the server supports it. More is explained in https://stackoverflow.com/a/54356305

A basic implementation would be to add a RequestID field to builds, and when wharf-api receives a POST /api/project/{projectId}/build, it will check in the recent builds if the same request ID has already been used, and if so then just use that build in the HTTP response instead of actually starting a new build.

Same goes for the other POST endpoints.

Alternatively, the wharf-api could hold a cache of recent request IDs and their HTTP responses in memory. But to support scaling the wharf-api, we would require some distributed cache such as Redis. Maybe worth still? The implementation would be so much simpler and wouldn't need to bloat the database.

@applejag applejag added enhancement New feature or request prio/0 Lowest priority. "Wishful thinking" labels Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio/0 Lowest priority. "Wishful thinking"
Projects
None yet
Development

No branches or pull requests

1 participant