新增:1、topic 记录到DB 2、http 发布事件支持 3、修复延时事件并发异常崩溃

git-svn-id: svn://47.119.165.148/zhub@127 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-09-02 17:10:21 +00:00
parent 15a73136cc
commit b5e55c9869
5 changed files with 148 additions and 43 deletions

View File

@@ -16,10 +16,18 @@ func StartHttp() {
http.HandleFunc("/info", info)
http.HandleFunc("/cleanup", cleanup)
http.HandleFunc("/retimer", retimer)
http.HandleFunc("/topic/publish", publish)
http.ListenAndServe(":1217", nil)
}
func publish(w http.ResponseWriter, r *http.Request) {
topic := r.FormValue("topic")
value := r.FormValue("value")
zsub.ZSubx().Publish(topic, value)
renderJson(w, "+ok")
}
func retimer(w http.ResponseWriter, r *http.Request) {
zsub.ZSubx().ReloadTimer()
renderJson(w, "+reload timer ok")