Commit 6c4c9d1c by CalciumIon

feat: only update task on master node

parent 4383b32b
...@@ -19,9 +19,6 @@ import ( ...@@ -19,9 +19,6 @@ import (
) )
func UpdateMidjourneyTaskBulk() { func UpdateMidjourneyTaskBulk() {
if !common.IsMasterNode {
return
}
//imageModel := "midjourney" //imageModel := "midjourney"
ctx := context.TODO() ctx := context.TODO()
for { for {
......
...@@ -89,12 +89,14 @@ func main() { ...@@ -89,12 +89,14 @@ func main() {
} }
go controller.AutomaticallyTestChannels(frequency) go controller.AutomaticallyTestChannels(frequency)
} }
common.SafeGoroutine(func() { if common.IsMasterNode {
controller.UpdateMidjourneyTaskBulk() common.SafeGoroutine(func() {
}) controller.UpdateMidjourneyTaskBulk()
common.SafeGoroutine(func() { })
controller.UpdateTaskBulk() common.SafeGoroutine(func() {
}) controller.UpdateTaskBulk()
})
}
if os.Getenv("BATCH_UPDATE_ENABLED") == "true" { if os.Getenv("BATCH_UPDATE_ENABLED") == "true" {
common.BatchUpdateEnabled = true common.BatchUpdateEnabled = true
common.SysLog("batch update enabled with interval " + strconv.Itoa(common.BatchUpdateInterval) + "s") common.SysLog("batch update enabled with interval " + strconv.Itoa(common.BatchUpdateInterval) + "s")
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment