Repository navigation
Conversation
| response = await http.put( | ||
| f'{api_url}/v2/acts/{actor.id}', | ||
| headers={**auth, 'Content-Type': 'application/json'}, | ||
| content=json.dumps({'actorStandby': {'isEnabled': True, 'tenancy': 'MULTI_TENANT'}}), | ||
| ) | ||
| assert response.status_code == 200, response.text |
There was a problem hiding this comment.
This will be better after apify/apify-client-python#1169
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1211 +/- ##
==========================================
+ Coverage 93.25% 93.44% +0.19%
==========================================
Files 54 54
Lines 3766 3800 +34
==========================================
+ Hits 3512 3551 +39
+ Misses 254 249 -5
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(...)
| ] | ||
| dependencies = [ | ||
| "apify-client[brotli]>=3.3.0,<4.0.0", | ||
| "apify-client[brotli]==3.4.1b2", |
There was a problem hiding this comment.
apify client 3.4.0 was released, so you can update it
request_idparam inActor.charge()#1193