Skip to content

sdk: remove webhook wait entries after async callback completion - #15

Open
chayu163 wants to merge 1 commit into
ZSvirt:mainfrom
chayu163:fix/sdk-webhook-async-cleanup
Open

sdk: remove webhook wait entries after async callback completion#15
chayu163 wants to merge 1 commit into
ZSvirt:mainfrom
chayu163:fix/sdk-webhook-async-cleanup

Conversation

@chayu163

@chayu163 chayu163 commented Sep 1, 2026

Copy link
Copy Markdown

Webhook-based async APIs are placed in the static waittingApis map before the request is sent. The sync path removes the entry after waiting, but the async callback path called completion.complete(res) without removing the finished job, causing long-running clients to retain stale Api references indefinitely.

Remove jobUuid from waittingApis once the async completion handler has been invoked. Sync webhook cleanup behavior is unchanged.

Fixes #11

Webhook-based async APIs are placed in the static waittingApis map
before the request is sent. The sync path removes the entry after
waiting, but the async callback path called completion.complete(res)
without removing the finished job, causing long-running clients to
retain stale Api references indefinitely.

Remove jobUuid from waittingApis once the async completion handler
has been invoked. Sync webhook cleanup behavior is unchanged.

Fixes ZSvirt#11
@zsphere-opensource

zsphere-opensource commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. We haven’t observed this issue in our current usage, but we agree that the async webhook path may retain completed entries. To help us evaluate the change, could you add a regression test demonstrating the cleanup behavior? It may also be safer to perform the removal in a finally block so cleanup still occurs if the completion handler throws. We’ll review the change further once the test is available.

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.

[ZSvirt] bug: SDK async webhook callbacks should remove completed APIs from waittingApis

2 participants