change Chan test

This commit is contained in:
yedf2 2021-07-29 00:29:49 +08:00
parent 0c7913fef1
commit 252d7862f4
2 changed files with 3 additions and 4 deletions

View File

@ -16,7 +16,9 @@ func CronTransOnce(expireIn time.Duration) bool {
if trans == nil { if trans == nil {
return false return false
} }
defer WaitTransProcessed(trans.Gid) if TransProcessedTestChan != nil {
defer WaitTransProcessed(trans.Gid)
}
trans.Process(dbGet()) trans.Process(dbGet())
return true return true
} }

View File

@ -38,9 +38,6 @@ var TransProcessedTestChan chan string = nil
// WaitTransProcessed only for test usage. wait for transaction processed once // WaitTransProcessed only for test usage. wait for transaction processed once
func WaitTransProcessed(gid string) { func WaitTransProcessed(gid string) {
if TransProcessedTestChan == nil {
return
}
logrus.Printf("waiting for gid %s", gid) logrus.Printf("waiting for gid %s", gid)
id := <-TransProcessedTestChan id := <-TransProcessedTestChan
for id != gid { for id != gid {