VOL-1577 - General cleanup (gofmt, go vet, go test, dep check)
Change-Id: I536b2746b8bd266f3e75aeccc65bfe7468f1b44a
diff --git a/db/model/base_test.go b/db/model/base_test.go
index 9d8a1a9..623d24b 100644
--- a/db/model/base_test.go
+++ b/db/model/base_test.go
@@ -33,28 +33,32 @@
DbTimeout int
}
-func commonCallback(args ...interface{}) interface{} {
- log.Infof("Running common callback - arg count: %s", len(args))
+var callbackMutex sync.Mutex
+
+func commonChanCallback(args ...interface{}) interface{} {
+ log.Infof("Running common callback - arg count: %d", len(args))
//for i := 0; i < len(args); i++ {
// log.Infof("ARG %d : %+v", i, args[i])
//}
- mutex := sync.Mutex{}
- mutex.Lock()
- defer mutex.Unlock()
+ callbackMutex.Lock()
+ defer callbackMutex.Unlock()
- execStatus := args[1].(*bool)
+ execDoneChan := args[1].(*chan struct{})
// Inform the caller that the callback was executed
- *execStatus = true
- log.Infof("Changed value of exec status to true - stack:%s", string(debug.Stack()))
+ if *execDoneChan != nil {
+ log.Infof("Sending completion indication - stack:%s", string(debug.Stack()))
+ close(*execDoneChan)
+ *execDoneChan = nil
+ }
return nil
}
func commonCallback2(args ...interface{}) interface{} {
- log.Infof("Running common2 callback - arg count: %s %+v", len(args), args)
+ log.Infof("Running common2 callback - arg count: %d %+v", len(args), args)
return nil
}