fix RegisteTickFunc (#2787)

This commit is contained in:
co63oc
2025-08-19 20:53:53 +08:00
committed by GitHub
parent 890a802481
commit eaea782693
10 changed files with 21 additions and 18 deletions

View File

@@ -123,11 +123,11 @@ var globalOnTickFuncs []TickFuncEntry = []TickFuncEntry{}
// You should call this function in parseConfig phase, for example:
//
// func parseConfig(json gjson.Result, config *HelloWorldConfig, log wrapper.Log) error {
// wrapper.RegisteTickFunc(1000, func() { proxywasm.LogInfo("onTick 1s") })
// wrapper.RegisteTickFunc(3000, func() { proxywasm.LogInfo("onTick 3s") })
// wrapper.RegisterTickFunc(1000, func() { proxywasm.LogInfo("onTick 1s") })
// wrapper.RegisterTickFunc(3000, func() { proxywasm.LogInfo("onTick 3s") })
// return nil
// }
func RegisteTickFunc(tickPeriod int64, tickFunc func()) {
func RegisterTickFunc(tickPeriod int64, tickFunc func()) {
globalOnTickFuncs = append(globalOnTickFuncs, TickFuncEntry{0, tickPeriod, tickFunc})
}