Skip to content
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

fix: balance cache invalidation on transaction creation #467

Conversation

tomudding
Copy link
Member

Description

Currently, balance cache is cleared when a transaction is created/updated/ deleted for a user. However, balance cache should not be invalidated when creating a transaction.

Creating a transaction is an action forward; new balance is just the sum of balance cache + all new transactions for that user. Thus, no need to remove it. Invalidating it is also bad for performance, as balance has to be calculated on the fly until next balance cache calculation (cronjob).

This removes balance cache invalidation for transaction creations.


Here confirmation of the old behaviour:
image
After creating a transaction:
image

Related issues/external references

GH-466

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Currently, balance cache is cleared when a transaction is created/updated/
deleted for a user. However, balance cache should not be invalidated when
creating a transaction.

Creating a transaction is an action forward; new balance is just the sum of
balance cache + all new transactions for that user. Thus, no need to remove it.
Invalidating it is also bad for performance, as balance has to be calculated on
the fly until next balance cache calculation (cronjob).

This removes balance cache invalidation for transaction creations.
@tomudding tomudding requested a review from JustSamuel February 12, 2025 17:38
Copy link
Contributor

@JustSamuel JustSamuel left a comment

Choose a reason for hiding this comment

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

I am still kinda worried why this was ever included? Do we even actually update the balance cache after this?

@tomudding
Copy link
Member Author

I am still kinda worried why this was ever included? Do we even actually update the balance cache after this?

I cannot answer the first question (see introduction in 3b24477), but it is updated/repopulated as expected at 01:14:
image

@JustSamuel JustSamuel merged commit 9d229d3 into GEWIS:develop Feb 13, 2025
6 checks passed
@tomudding tomudding linked an issue Feb 13, 2025 that may be closed by this pull request
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.

Do not invalidate balance cache for user when creating transaction
2 participants