From 75a839bc6468c3fede48d18e4be4ae262ccd0a44 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期二, 14 一月 2020 16:50:11 +0800 Subject: [PATCH] debug --- run.go | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/run.go b/run.go index bda030f..5de86cb 100644 --- a/run.go +++ b/run.go @@ -13,7 +13,7 @@ "basic.com/valib/gogpu.git" ) -const maxTryBeforeReboot = 30 +const maxTryBeforeReboot = 10 type face struct { handle *SDKFace @@ -57,7 +57,10 @@ } else { f.rebootUntil++ + f.fnLogger("Face No Running: ", f.rebootUntil) if f.rebootUntil > maxTryBeforeReboot { + f.fnLogger("Face Too Long Running, Reboot") + f.release() os.Exit(0) } } @@ -155,6 +158,12 @@ } } +func (f *face) release() { + if f.handle != nil { + f.handle.Free() + } +} + // Run run func Run(ctx context.Context, i interface{}) { s := i.(*face) @@ -165,8 +174,8 @@ ) ipcRcv := sdkhelper.GetIpcAddress(s.shm, s.id+postPull) ipcSnd := sdkhelper.GetIpcAddress(s.shm, s.id+postPush) - chRcv := make(chan []byte) - chSnd := make(chan sdkstruct.MsgSDK) + chRcv := make(chan []byte, s.maxChannel) + chSnd := make(chan sdkstruct.MsgSDK, s.maxChannel) rcver := sdkhelper.NewReciever(ipcRcv, chRcv, s.shm, s.fnLogger) snder := sdkhelper.NewSender(ipcSnd, chSnd, s.shm, s.fnLogger) -- Gitblit v1.8.0