[db] Enbancement add traffic fully transactional

- Remove expiration process of client/inbound with separate cron
- Combine expiration process to add traffic
- Combine calculation of all the traffics to one database transaction
This commit is contained in:
Alireza Ahmadi
2023-08-25 18:24:40 +02:00
parent 55ae60594f
commit 28a3fc813c
5 changed files with 64 additions and 116 deletions

View File

@@ -244,9 +244,6 @@ func (s *Server) startTask() {
s.cron.AddJob("@every 10s", job.NewXrayTrafficJob())
}()
// Check the inbound traffic every 30 seconds that the traffic exceeds and expires
s.cron.AddJob("@every 30s", job.NewCheckInboundJob())
// Make a traffic condition every day, 8:30
var entry cron.EntryID
isTgbotenabled, err := s.settingService.GetTgbotenabled()