This is an automated email from the ASF dual-hosted git repository.

likyh pushed a commit to branch release-v0.14
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 992c0744160299914836899e8ed377eab51208e6
Author: linyh <[email protected]>
AuthorDate: Wed Oct 19 19:42:02 2022 +0800

    fix: confirm all graphql task finish
---
 plugins/helper/graphql_async_client.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/helper/graphql_async_client.go 
b/plugins/helper/graphql_async_client.go
index 91be1728..fcd46aef 100644
--- a/plugins/helper/graphql_async_client.go
+++ b/plugins/helper/graphql_async_client.go
@@ -131,12 +131,15 @@ func (apiClient *GraphqlAsyncClient) NextTick(task func() 
errors.Error) {
        // to make sure task will be enqueued
        apiClient.waitGroup.Add(1)
        go func() {
-               defer apiClient.waitGroup.Done()
                select {
                case <-apiClient.ctx.Done():
                        return
                default:
                        go func() {
+                               // if set waitGroup done here, a serial of 
goruntine will block until son goruntine finish.
+                               // But if done out of this go func, so task 
will run after waitGroup finish
+                               // I have no idea about this now...
+                               defer apiClient.waitGroup.Done()
                                apiClient.checkError(task())
                        }()
                }

Reply via email to