Skip to content

Commit

Permalink
feat(初始化): 插件重启锁机制
Browse files Browse the repository at this point in the history
- 重启驱动所有插件时,添加同步锁
  • Loading branch information
xcocx committed Jun 4, 2024
1 parent 43b33f7 commit 0e62d78
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions driverbox/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ import (
"github.com/ibuilding-x/driver-box/driverbox/helper"
"github.com/ibuilding-x/driver-box/internal/bootstrap"
"go.uber.org/zap"
"sync"
)

// reloadLock 用于控制 plugin 重载的互斥锁
var reloadLock sync.Mutex

// ReloadPlugins 重载所有插件
func ReloadPlugins() error {
reloadLock.Lock()
defer reloadLock.Unlock()

// 1. 停止所有 timerTask 任务
helper.Crontab.Stop()
// 2. 停止运行中的 plugin
Expand Down

0 comments on commit 0e62d78

Please sign in to comment.