Commit 8d7b2819 authored by vicotor's avatar vicotor

add task loop interval param.

parent 3baa11b2
debug = false
task_loop_interval = 30
aeskey = "/app/keys/aes.key"
otpkey = "/app/keys/val.otp"
......
......@@ -5,11 +5,12 @@ import (
)
type Config struct {
Debug bool
AesKeyPath string `toml:"aeskey"`
OTPKeyPath string `toml:"otpkey"`
Chains map[string]*ChainConfig `toml:"chains"`
MySQL MySQLConfig
Debug bool
TaskLoopInterval int `toml:"task_loop_interval"`
AesKeyPath string `toml:"aeskey"`
OTPKeyPath string `toml:"otpkey"`
Chains map[string]*ChainConfig `toml:"chains"`
MySQL MySQLConfig
}
type ChainConfig struct {
......
......@@ -219,7 +219,7 @@ func (d *Dao) HandleTasks() {
defer d.wg.Done()
ticker := time.NewTicker(5 * time.Second)
maxCount := 5
maxCount := 30
offset := 0
defer ticker.Stop()
......@@ -232,6 +232,9 @@ func (d *Dao) HandleTasks() {
if d.validatorPk == nil {
continue
}
if d.c.TaskLoopInterval >= 1 {
ticker.Reset(time.Duration(d.c.TaskLoopInterval) * time.Second)
}
// select unprocessed bridge event with maxCount.
events, err := d.GetUnprocessedBridgeEvents(maxCount, offset)
if err != nil {
......
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