Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
token-bridge
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
movabridge
token-bridge
Commits
657295ea
Commit
657295ea
authored
Nov 20, 2025
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add task retry interval param.
parent
8d7b2819
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
14 deletions
+16
-14
config.toml
config.toml
+1
-1
config.go
config/config.go
+6
-6
db.go
dao/db.go
+2
-2
eth.go
dao/eth.go
+7
-5
No files found.
config.toml
View file @
657295ea
debug
=
false
task_
loop
_interval
=
30
task_
retry
_interval
=
30
aeskey
=
"/app/keys/aes.key"
otpkey
=
"/app/keys/val.otp"
...
...
config/config.go
View file @
657295ea
...
...
@@ -6,7 +6,7 @@ import (
type
Config
struct
{
Debug
bool
Task
LoopInterval
int
`toml:"task_loop
_interval"`
Task
RetryInterval
int
`toml:"task_retry
_interval"`
AesKeyPath
string
`toml:"aeskey"`
OTPKeyPath
string
`toml:"otpkey"`
Chains
map
[
string
]
*
ChainConfig
`toml:"chains"`
...
...
dao/db.go
View file @
657295ea
...
...
@@ -29,8 +29,8 @@ func (d *Dao) SetStorageHeight(key string, intValue int64) (err error) {
func
(
d
*
Dao
)
GetUnprocessedBridgeEvents
(
limit
int
,
offset
int
)
(
events
[]
*
dbModel
.
BridgeEvent
,
err
error
)
{
err
=
d
.
db
.
Model
(
&
dbModel
.
BridgeEvent
{})
.
Where
(
"`from_chain_tx_hash` != '' AND `to_chain_status` < ? AND `validator_status` = ?"
,
2
,
constant
.
ValidatorStatusNoPrecess
)
.
Order
(
"
cre
ated_at ASC"
)
.
Where
(
"`from_chain_tx_hash` != '' AND `to_chain_status` < ? AND `validator_status` = ?"
,
constant
.
TransferChainExecuted
,
constant
.
ValidatorStatusNoPrecess
)
.
Order
(
"
upd
ated_at ASC"
)
.
Limit
(
limit
)
.
Offset
(
offset
)
.
Find
(
&
events
)
.
Error
...
...
dao/eth.go
View file @
657295ea
...
...
@@ -183,7 +183,7 @@ func (d *Dao) SubmitInTransfer(event *dbModel.BridgeEvent) error {
if
tx
,
err
:=
ca
.
SubmitInTransfer
(
opts
,
param
);
err
!=
nil
{
log
.
WithField
(
"chainId"
,
chain
.
conf
.
ChainId
)
.
WithError
(
err
)
.
Error
(
"failed to submit in transfer"
)
return
err
return
d
.
UpdateBridgeValidatorOperation
(
event
,
constant
.
ValidatorStatusNoPrecess
)
}
else
{
// wait tx result and update validator status.
receipt
,
err
:=
bind
.
WaitMined
(
context
.
Background
(),
chain
.
cli
,
tx
)
...
...
@@ -218,7 +218,7 @@ func (d *Dao) CheckEventValid() bool {
func
(
d
*
Dao
)
HandleTasks
()
{
defer
d
.
wg
.
Done
()
ticker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
ticker
:=
time
.
NewTicker
(
10
*
time
.
Second
)
maxCount
:=
30
offset
:=
0
defer
ticker
.
Stop
()
...
...
@@ -232,9 +232,6 @@ 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
{
...
...
@@ -261,6 +258,11 @@ func (d *Dao) HandleTasks() {
continue
}
if
event
.
UpdatedAt
.
Compare
(
event
.
CreatedAt
)
>
0
&&
(
int
(
event
.
UpdatedAt
.
Sub
(
time
.
Now
())
.
Seconds
())
<
d
.
c
.
TaskRetryInterval
)
{
// skip recently failed tasks.
continue
}
if
err
:=
d
.
SubmitInTransfer
(
event
);
err
!=
nil
{
log
.
WithError
(
err
)
.
WithFields
(
log
.
Fields
{
"fromChain"
:
event
.
FromChain
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment