Browse Source

fix: add delay for delete plugin tasks when success

Yeuoly 8 months ago
parent
commit
9f8a0dccae
1 changed files with 4 additions and 1 deletions
  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)
 					}