-
Notifications
You must be signed in to change notification settings - Fork 86
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
start_date and end_date filter on balance API doesn't work correctly if an exisiting balance snapshot is present #109
Comments
Hello Thanks for reporting! The idea behind caching the balances is that the key for the cache would be the mongodb query itself. However, looks like we have a bug. The The correct fix would be:
We'd be happy with your contribution! |
Hi team, wanted to take this up. Fix suggested by @koresar will be easy to do, but then it will not be Ideal solution could be [as suggested by @amitex007] to store query start_date and end_date in Way forward could be:
@koresar what do you say? |
@soumitdas thank you for thinking this through. I greatly support everything you've said. The item 2 would be especially valuable for everyone. But I am certainly not going to implement this feature. No time. :) Please, implement! |
Now we are aligned on the approach, I will start the implementation. Please assign the issue to me. |
We should not start cookie licking ;). Also i dont see any other person wanting to implement your suggestion. So you should be safe. I also thought about this approach, few yeara ago. We need to ensure that balances are invalidated when there are new transactions made in that duration. This is the actual issue which needs extra focus. |
What does "transactions made in that duration" means? Like,
Right? |
Yes. And especially edge cases with seconds etc.. |
Hi Medici team,
It seems that the balance API doesn't return the correct values if there is a cached balance entry in balance_snapshots.
If the start_date and end_date are values before the last transaction Id in the snapshot, the balance API just returns the balance in the snapshot.
link
I suggest that we should also maintain a start_time and end_time in the balance snapshot and check if the range query can be satisfied by the snapshot. Else recalculate accordingly.
Happy to raise a PR for the same if we agree on a solution.
Or please suggest a work-around which doesn't turn the caching feature completely off.
Thanks
The text was updated successfully, but these errors were encountered: