Commit 8d7b2819 authored by vicotor's avatar vicotor

add task loop interval param.

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