mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-26 18:14:50 +00:00
fix: correct log message for completed periodic traffic reset
This commit is contained in:
parent
6fce769c27
commit
ec7f28179c
3 changed files with 4 additions and 8 deletions
|
|
@ -39,6 +39,6 @@ func (j *PeriodicTrafficResetJob) Run() {
|
|||
}
|
||||
|
||||
if resetCount > 0 {
|
||||
logger.Infof("Periodic traffic reset completed: %d inbounds reset", resetCount)
|
||||
logger.Infof("Periodic traffic reset completed: %d inbounds reseted", resetCount)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,12 +44,10 @@ func (s *InboundService) GetAllInbounds() ([]*model.Inbound, error) {
|
|||
func (s *InboundService) GetInboundsByTrafficReset(period string) ([]*model.Inbound, error) {
|
||||
db := database.GetDB()
|
||||
var inbounds []*model.Inbound
|
||||
logger.Info("Fetching inbounds with traffic reset period:", period)
|
||||
err := db.Model(model.Inbound{}).Where("traffic_reset = ?", period).Find(&inbounds).Error
|
||||
if err != nil && err != gorm.ErrRecordNotFound {
|
||||
return nil, err
|
||||
}
|
||||
logger.Infof("Found %d inbounds with traffic reset period: %s", len(inbounds), period)
|
||||
return inbounds, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -271,19 +271,17 @@ func (s *Server) startTask() {
|
|||
{
|
||||
// Inbound traffic reset jobs
|
||||
// Run once a day, midnight
|
||||
// TODO: for testing, run every minute, change back to daily later
|
||||
// s.cron.AddJob("@daily", job.NewPeriodicTrafficResetJob("daily"))
|
||||
s.cron.AddJob("@every 10s", job.NewPeriodicTrafficResetJob("daily"))
|
||||
s.cron.AddJob("@daily", job.NewPeriodicTrafficResetJob("daily"))
|
||||
// Run once a week, midnight between Sat/Sun
|
||||
s.cron.AddJob("@weekly", job.NewPeriodicTrafficResetJob("weekly"))
|
||||
// Run once a month, midnight, first of month
|
||||
s.cron.AddJob("@monthly", job.NewPeriodicTrafficResetJob("monthly"))
|
||||
|
||||
// Client traffic reset jobs
|
||||
// TODO: Client traffic reset jobs
|
||||
// logger.Info("Scheduling periodic client traffic reset jobs")
|
||||
// Run once a day, midnight
|
||||
// TODO: for testing, run every minute, change back to daily later
|
||||
// s.cron.AddJob("@daily", job.NewPeriodicClientTrafficResetJob("daily"))
|
||||
// s.cron.AddJob("@every 10s", job.NewPeriodicClientTrafficResetJob("daily"))
|
||||
// s.cron.AddJob("* * * * *", job.NewPeriodicClientTrafficResetJob("daily"))
|
||||
// Run once a week, midnight between Sat/Sun
|
||||
// s.cron.AddJob("@weekly", job.NewPeriodicClientTrafficResetJob("weekly"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue