浏览代码

fix: add delay for delete plugin tasks when success

Yeuoly 8 月之前
父节点
当前提交
9f8a0dccae
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      internal/service/install_plugin.go

+ 4 - 1
internal/service/install_plugin.go

@@ -3,6 +3,7 @@ package service
 import (
 	"errors"
 	"fmt"
+	"time"
 
 	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_manager"
 	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_packager/decoder"
@@ -172,7 +173,9 @@ func InstallPluginRuntimeToTenant(
 					// delete the task if all plugins are installed successfully,
 					// otherwise update the task status
 					if successes == len(taskPointer.Plugins) {
-						return db.Delete(taskPointer, tx)
+						time.AfterFunc(120*time.Second, func() {
+							db.Delete(taskPointer, tx)
+						})
 					} else {
 						return db.Update(taskPointer, tx)
 					}