dwyl / alog

🌲 alog (Append-only Log) is an easy way to start using the Lambda/Kappa architecture in your Elixir/Phoenix Apps while still using PostgreSQL (with Ecto).
GNU General Public License v2.0
15 stars 2 forks source link

Outdated items being retrieved in `get_by` #27

Open Danwhy opened 5 years ago

Danwhy commented 5 years ago

The get_by function is returning old values of an entry if they match the clauses passed in and the most recent one does not. We need to check that the item being returned is the most recent, else we should return nil.

We can do this by performing a get call on the item's entry id once we have it, then comparing the results to make sure they match. This will add an extra query though, so it would be better to add this check to the original query. If anybody has time to make this improvement, please do.