[ 
https://issues.apache.org/jira/browse/SCB-958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16647328#comment-16647328
 ] 

ASF GitHub Bot commented on SCB-958:
------------------------------------

little-cui closed pull request #456: SCB-958 The instance delete event delay 
more than 2s
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/456
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/core/backend/defer_instance.go 
b/server/core/backend/defer_instance.go
index 82e81b06..7f3f459f 100644
--- a/server/core/backend/defer_instance.go
+++ b/server/core/backend/defer_instance.go
@@ -135,6 +135,9 @@ func (iedh *InstanceEventDeferHandler) check(ctx 
context.Context) {
                        t.Reset(deferCheckWindow)
 
                        if !iedh.enabled {
+                               for _, item := range iedh.items {
+                                       iedh.recover(item.event)
+                               }
                                continue
                        }
 
diff --git a/server/core/backend/defer_test.go 
b/server/core/backend/defer_test.go
index bb246fc8..f80f57c1 100644
--- a/server/core/backend/defer_test.go
+++ b/server/core/backend/defer_test.go
@@ -91,6 +91,27 @@ func TestInstanceEventDeferHandler_HandleChan(t *testing.T) {
        }
 
        cache := &mockCache{c: make(map[string]*discovery.KeyValue)}
+       cache.Put("/1", kv1)
+       evts0 := []discovery.KvEvent{
+               {
+                       Type: pb.EVT_DELETE,
+                       KV:   kv1,
+               },
+       }
+
+       iedh := &InstanceEventDeferHandler{
+               Percent: 1,
+       }
+       iedh.OnCondition(cache, evts0)
+       select {
+       case evt := <-iedh.HandleChan():
+               if string(evt.KV.Key) != "/1" || evt.Type != pb.EVT_DELETE {
+                       t.Fatalf(`TestInstanceEventDeferHandler_HandleChan 
DELETE failed`)
+               }
+       case <-time.After(deferCheckWindow + time.Second):
+               t.Fatalf(`TestInstanceEventDeferHandler_HandleChan DELETE timed 
out`)
+       }
+
        cache.Put("/1", kv1)
        cache.Put("/2", kv2)
        cache.Put("/3", kv3)
@@ -149,10 +170,7 @@ func TestInstanceEventDeferHandler_HandleChan(t 
*testing.T) {
                },
        }
 
-       iedh := &InstanceEventDeferHandler{
-               Percent: 0.01,
-       }
-
+       iedh.Percent = 0.01
        iedh.OnCondition(cache, evts1)
        iedh.OnCondition(cache, evts2)
        iedh.OnCondition(cache, evts3)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> The instance delete event delay more than 2s
> --------------------------------------------
>
>                 Key: SCB-958
>                 URL: https://issues.apache.org/jira/browse/SCB-958
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Service-Center
>            Reporter: little-cui
>            Assignee: little-cui
>            Priority: Critical
>             Fix For: service-center-1.1.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to