feat: support automatic channel testing & balance updates (close #11, close #59)

This commit is contained in:
JustSong
2023-06-22 22:01:03 +08:00
parent ad1049b0cf
commit 4463224f04
5 changed files with 57 additions and 15 deletions

View File

@@ -257,6 +257,7 @@ func updateAllChannelsBalance() error {
disableChannel(channel.Id, channel.Name, "余额不足")
}
}
time.Sleep(common.RequestInterval)
}
return nil
}
@@ -277,3 +278,12 @@ func UpdateAllChannelsBalance(c *gin.Context) {
})
return
}
func AutomaticallyUpdateChannels(frequency int) {
for {
time.Sleep(time.Duration(frequency) * time.Minute)
common.SysLog("updating all channels")
_ = updateAllChannelsBalance()
common.SysLog("channels update done")
}
}