From 8e295ee36929aab908d4ac95d1d8d33ff8a627f3 Mon Sep 17 00:00:00 2001 From: chayu <3317038611@qq.com> Date: Tue, 1 Sep 2026 11:14:44 +0800 Subject: [PATCH] sdk: remove webhook wait entries after async callback completion 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 --- sdk/src/main/java/org/zstack/sdk/ZSClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/src/main/java/org/zstack/sdk/ZSClient.java b/sdk/src/main/java/org/zstack/sdk/ZSClient.java index 569e1d5f..e9b83e3c 100644 --- a/sdk/src/main/java/org/zstack/sdk/ZSClient.java +++ b/sdk/src/main/java/org/zstack/sdk/ZSClient.java @@ -241,6 +241,7 @@ void wakeUpFromWebHook(ApiResult res) { res.error.details = t.getMessage(); completion.complete(res); } + waittingApis.remove(jobUuid); } }