check_hash_storage.go 611 B

123456789101112131415161718192021
  1. package job
  2. import (
  3. "github.com/mhsanaei/3x-ui/v2/web/service"
  4. )
  5. // CheckHashStorageJob periodically cleans up expired hash entries from the Telegram bot's hash storage.
  6. type CheckHashStorageJob struct {
  7. tgbotService service.Tgbot
  8. }
  9. // NewCheckHashStorageJob creates a new hash storage cleanup job instance.
  10. func NewCheckHashStorageJob() *CheckHashStorageJob {
  11. return new(CheckHashStorageJob)
  12. }
  13. // Run removes expired hash entries from the Telegram bot's hash storage.
  14. func (j *CheckHashStorageJob) Run() {
  15. // Remove expired hashes from storage
  16. j.tgbotService.GetHashStorage().RemoveExpiredHashes()
  17. }