Repository navigation
feat: Support multi-tenant Server Actors in Actor.charge() - #1211
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1211 +/- ##
==========================================
- Coverage 93.94% 93.83% -0.12%
==========================================
Files 54 54
Lines 3850 3893 +43
==========================================
+ Hits 3617 3653 +36
- Misses 233 240 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pijukatel
left a comment
There was a problem hiding this comment.
It feels like an attachment to conceptually same method, that should have separate implementation though.
Actor.charge in normal actor runs is responsible for
- book keeping of the events + newly persistence
- limit enforcement
- API call
in multi tenant sever actor there is no enforcement and the bookkeeping is pointless so it is there only for the API call. So this similar but different method goes through the same code paths, but has so much dead code along the way.
In order to make this distinction more clear I would be in favor of some separation. For example something in this direction:
Having overloads for normal charge
async def charge(
self,
event_name: str,
*,
count: int = 1,
idempotency_key: str | None = None,
Server charge where the request_id is actually mandatory
async def charge(
self,
event_name: str,
*,
count: int = 1,
idempotency_key: str | None = None,
request_id: str,
And the method should clearly delegate to distinct internal functions
async def charge(...)
# param checks and warnings
if ...
return _server_charge(...)
return _charge(...)
vdusek
left a comment
There was a problem hiding this comment.
One more comment regarding docs. Otherwise LGTM.
charge() for multi-tenant Server Actors
charge() for multi-tenant Server ActorsActor.charge()
vdusek
left a comment
There was a problem hiding this comment.
A few things that should be clarified before merging
request_idparam inActor.charge()#1193