Commit a6e286cc authored by Lei Li's avatar Lei Li
Browse files

feat: 增加所有插件都启动的接口

parent d16eda57
...@@ -14,7 +14,10 @@ import ( ...@@ -14,7 +14,10 @@ import (
"linkfog.com/public/lib/l" "linkfog.com/public/lib/l"
) )
var EnableValidatePluginMD5 = true var (
EnableValidatePluginMD5 = true
InitDur time.Duration
)
type pluginProcess struct { type pluginProcess struct {
conf *PluginProcessConf conf *PluginProcessConf
...@@ -128,6 +131,6 @@ func GetProcRSS(pid int) (rss uint64, err error) { ...@@ -128,6 +131,6 @@ func GetProcRSS(pid int) (rss uint64, err error) {
} }
func pathExists(path string) bool { func pathExists(path string) bool {
_,err := os.Stat(path) _, err := os.Stat(path)
return err == nil || os.IsExist(err) return err == nil || os.IsExist(err)
} }
...@@ -63,7 +63,7 @@ func (mgr *PluginProcessMgr) Stop() { ...@@ -63,7 +63,7 @@ func (mgr *PluginProcessMgr) Stop() {
func (mgr *PluginProcessMgr) run() { func (mgr *PluginProcessMgr) run() {
mgr.detection() mgr.detection()
ticker := time.NewTicker(10 * time.Second) ticker := time.NewTicker(InitDur)
defer ticker.Stop() defer ticker.Stop()
defer close(mgr.doneResp) defer close(mgr.doneResp)
for { for {
...@@ -163,3 +163,13 @@ func (mgr *PluginProcessMgr) unregisterAllProcess() { ...@@ -163,3 +163,13 @@ func (mgr *PluginProcessMgr) unregisterAllProcess() {
mgr.unregisterProcess(name, p) mgr.unregisterProcess(name, p)
} }
} }
func (mgr *PluginProcessMgr) AllPluginProcessIsRunning() bool {
for _, p := range mgr.pluginProcessMap {
if p.isExited() {
return false
}
}
return true
}
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 to comment