mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 15:30:26 +00:00
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user