Skip to content

feat(charging): Support the idempotency_key param in Actor.charge() - #1123

Open
Mantisus wants to merge 9 commits into
apify:masterfrom
Mantisus:charge-idempotency-key
Open

Mantisus wants to merge 9 commits into
apify:masterfrom
Mantisus:charge-idempotency-key

Conversation

@Mantisus

@Mantisus Mantisus commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Adds support for the idempotency_key parameter in Actor.charge().

Closes: #1122

@Mantisus Mantisus changed the title feat(charging): Allow passing an idempotency key to charge() feat(charging): Support the idempotency_key param in Actor.charge() Sep 8, 2026
@Mantisus Mantisus self-assigned this Sep 8, 2026
@Mantisus
Mantisus requested a review from vdusek September 8, 2026 21:28
@vdusek
vdusek requested a review from szaganek as a code owner September 11, 2026 11:04
Comment thread src/apify/_charging.py Outdated
@Mantisus

Copy link
Copy Markdown
Collaborator Author

@barjin, Please take a look at the implementation.

In the TS SDK, the idempotency_key doesn't affect the ChargingManager. This will cause desynchronization in cases where the API rejects a request with a duplicate idempotency_key.

@barjin barjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @Mantisus !

Good catch, we need this in JS SDK as well, otherwise the deduplicated charges will eventually desync the running total count. I opened an issue here.

Otherwise, I left a few ideas regarding the implementation ⬇️ Thanks again!

Comment thread src/apify/_charging.py Outdated
Comment thread src/apify/_charging.py Outdated
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.

Support the idempotency_key param in Actor.charge()

4 participants