Skip to content

Allow API to serve delayed data#34

Merged
Siegrift merged 12 commits intomainfrom
delayed-data
Sep 25, 2023
Merged

Allow API to serve delayed data#34
Siegrift merged 12 commits intomainfrom
delayed-data

Conversation

@Siegrift
Copy link
Collaborator

@Siegrift Siegrift commented Sep 24, 2023

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.json with 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.

@Siegrift Siegrift self-assigned this Sep 24, 2023
@Siegrift Siegrift changed the title WIP: Allow API to serve delayed data Allow API to serve delayed data Sep 24, 2023
@Siegrift Siegrift requested a review from andreogle September 24, 2023 11:53
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow API to serve delayed data

2 participants