Conversation
2063f7b to
2ad4b6f
Compare
andreogle
approved these changes
Sep 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21
Rationale
The main change is how the signed data is stored. We no longer store the latest data for each beacon, but we keep an array of data instead. This makes it easy to compute the freshest data for each endpoint while keeps the memory quite generic. With this change it is no longer possible to update signed data - pusher can only append signed data to this service which always accepts valid data (and may decide to "forget" about it is not needed).
To support multiple endpoints, it is clear we need some configuration. I opted for
signed-api.jsonwith basic schema that allows to configure an endpoint with a delay (currently without auth). The signed API ignores all data that is too fresh and was submitted after"Date.now() - delayInMs". I then realized, we no longer need the ENV file and can instead merge this with the config (so that we have a single file to maintain).I added some basic tests and minor refactors to simplify the code.
Note, that I have not added support for pruning old data and instead created a separate issue #35 since the PR is quite big already.