- category sync almost ok.
- refactor tasksch (isContinueWhenError)
This commit is contained in:
@@ -13,7 +13,10 @@ func TestTaskMan(t *testing.T) {
|
||||
for k := range itemList {
|
||||
itemList[k] = k
|
||||
}
|
||||
task1 := RunManagedTask("test", func(batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
task1 := RunManagedTask("test", false, func(taskName string, result []interface{}, err error) {
|
||||
// t.Log("finished here")
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}, 100, 7, "autotest", func(batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
sleepSecond := rand.Intn(5)
|
||||
t.Logf("sleep %d seconds", sleepSecond)
|
||||
time.Sleep(time.Duration(sleepSecond) * time.Second)
|
||||
@@ -22,12 +25,12 @@ func TestTaskMan(t *testing.T) {
|
||||
retSlice[k] = "hello:" + utils.Int2Str(batchItemList[k].(int)*2)
|
||||
}
|
||||
return retSlice, nil
|
||||
}, func(taskName string, result []interface{}, err error) {
|
||||
// t.Log("finished here")
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}, 100, 7, "autotest", itemList, "a", "b", 1, 2)
|
||||
}, itemList, "a", "b", 1, 2)
|
||||
|
||||
task2 := RunManagedTask("test", func(batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
task2 := RunManagedTask("test", false, func(taskName string, result []interface{}, err error) {
|
||||
// t.Log("finished here")
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}, 100, 7, "autotest", func(batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
sleepSecond := rand.Intn(5)
|
||||
t.Logf("sleep %d seconds", sleepSecond)
|
||||
time.Sleep(time.Duration(sleepSecond) * time.Second)
|
||||
@@ -36,10 +39,7 @@ func TestTaskMan(t *testing.T) {
|
||||
retSlice[k] = "hello:" + utils.Int2Str(batchItemList[k].(int)*2)
|
||||
}
|
||||
return retSlice, nil
|
||||
}, func(taskName string, result []interface{}, err error) {
|
||||
// t.Log("finished here")
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}, 100, 7, "autotest", itemList, "a", "b", 1, 2)
|
||||
}, itemList, "a", "b", 1, 2)
|
||||
time.Sleep(2 * time.Second)
|
||||
task2.Cancel()
|
||||
if task1.GetStatus() == task2.GetStatus() {
|
||||
|
||||
Reference in New Issue
Block a user