Lombiq/Hosting-Tenants

EmailQuotaService has unnecessary ISession.SaveAsync() calls (OSOE-848)

Closed this issue · 5 comments

While those shouldn't be necessary. See OrchardCMS/OrchardCore#15290 (comment).

Jira issue

I removed all and after that just some of the SaveAsync() calls and experienced broken behavior and failing UI tests. I sense that they might indeed be necessary.

Broken how?

"in the EmailQuotaService all the methods updating the quota instance also call SaveAsync but it's not necessary since it's either coming from the database or being created and then tracked"

For example when removing it from IncreaseEmailUsageAsync it is just not counting the emails sent.

If I remove the others the tests are still working but this can be due to the Tests not touching those funcionalities that would be broken upon removing these.

As far this is all info I have collected.

But I highly suspect that if emailQuota.CurrentEmailUsageCount++ is not working without SaveAsync then emailQuota.CurrentEmailUsageCount = 0; shouldn't be working aswell it is just not tested.

I see. Let's keep them, then, but please add a comment about this above the class so we don't try to remove them again.