Просмотр исходного кода

chore: UpdateMidjourneyTaskBulk with SafeGoroutine

CaIon 2 лет назад
Родитель
Сommit
d30b9321b2
2 измененных файлов с 3 добавлено и 7 удалено
  1. 0 6
      controller/midjourney.go
  2. 3 1
      main.go

+ 0 - 6
controller/midjourney.go

@@ -148,12 +148,6 @@ import (
 */
 
 func UpdateMidjourneyTaskBulk() {
-	//revocer
-	defer func() {
-		if err := recover(); err != nil {
-			log.Printf("UpdateMidjourneyTask panic: %v", err)
-		}
-	}()
 	//imageModel := "midjourney"
 	ctx := context.TODO()
 	for {

+ 3 - 1
main.go

@@ -85,7 +85,9 @@ func main() {
 		}
 		go controller.AutomaticallyTestChannels(frequency)
 	}
-	go controller.UpdateMidjourneyTaskBulk()
+	common.SafeGoroutine(func() {
+		controller.UpdateMidjourneyTaskBulk()
+	})
 	if os.Getenv("BATCH_UPDATE_ENABLED") == "true" {
 		common.BatchUpdateEnabled = true
 		common.SysLog("batch update enabled with interval " + strconv.Itoa(common.BatchUpdateInterval) + "s")