endlessm / azafea

Service to track device activations and usage metrics
Mozilla Public License 2.0
10 stars 2 forks source link

metrics: Improve the image version deduplication #93

Closed bochecha closed 4 years ago

bochecha commented 4 years ago

The code was written to keep a single image version event for each database transaction… even if they came from different metrics requests.

This is wrong, and this commit fixes it so that we only keep a single image version event per request.

The risk is theoretical at the moment because Azafea processes one request at a time, so the metrics request and the db session effectively have the same life cycle.

However, this has the potential to blow and cause data loss due to changes in the future if we changed that, so let's fix it now before it causes trouble.