From f4dfd4f8470ec960ecd7e982566a8635bbceaca7 Mon Sep 17 00:00:00 2001 From: zhangyunyang02 Date: Sat, 7 Dec 2019 20:28:01 +0800 Subject: [PATCH] fix bug: ReadTopologyInstanceBufferable can not return error when crash --- go/inst/instance_dao.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/inst/instance_dao.go b/go/inst/instance_dao.go index 96d104246..d8dff34ed 100644 --- a/go/inst/instance_dao.go +++ b/go/inst/instance_dao.go @@ -265,10 +265,10 @@ func expectReplicationThreadsState(instanceKey *InstanceKey, expectedState Repli // It writes the information retrieved into orchestrator's backend. // - writes are optionally buffered. // - timing information can be collected for the stages performed. -func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool, latency *stopwatch.NamedStopwatch) (*Instance, error) { +func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool, latency *stopwatch.NamedStopwatch) (inst *Instance, err error) { defer func() { - if err := recover(); err != nil { - logReadTopologyInstanceError(instanceKey, "Unexpected, aborting", fmt.Errorf("%+v", err)) + if r := recover(); r != nil { + err = logReadTopologyInstanceError(instanceKey, "Unexpected, aborting", fmt.Errorf("%+v", r)) } }()