Skip to content

Commit

Permalink
perf: 优化模块注册流程
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Mar 15, 2024
1 parent 8507a9a commit f0d3f9f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion dbase/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func Connect() {
&tables.Setting{},
)

// 全局配置迁移
// 加载全局配置
setting.DataMigrate()
setting.Laod()

}
8 changes: 0 additions & 8 deletions httpd/sundry/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"github.com/opentdp/go-helper/httpd"

"github.com/opentdp/wechat-rest/httpd/middle"
"github.com/opentdp/wechat-rest/wclient/crond"
"github.com/opentdp/wechat-rest/wclient/plugin"
)

func Route() {
Expand All @@ -26,10 +24,4 @@ func Route() {
rg.POST("plugin/cronjobs", pluginCronjobs)
rg.POST("plugin/keywords", pluginKeywords)

// 初始化

crond.Daemon()
plugin.CronjobPluginSetup()
plugin.KeywordPluginSetup()

}
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/opentdp/wechat-rest/args"
"github.com/opentdp/wechat-rest/dbase"
"github.com/opentdp/wechat-rest/httpd"
"github.com/opentdp/wechat-rest/wclient/crond"
"github.com/opentdp/wechat-rest/wclient/plugin"
"github.com/opentdp/wechat-rest/wclient/robot"
)

Expand All @@ -18,7 +20,12 @@ func main() {

dbase.Connect()

crond.Daemon()
plugin.CronjobPluginSetup()
plugin.KeywordPluginSetup()

robot.Start()

httpd.Server()

}
2 changes: 0 additions & 2 deletions wclient/robot/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ var wc *wcferry.Client

func Start() {

setting.Laod()

if !setting.BotEnable {
logman.Warn("robot disabled")
return
Expand Down

0 comments on commit f0d3f9f

Please sign in to comment.