2023-05-20 20:29:28 +04:30
|
|
|
package job
|
|
|
|
|
|
|
|
|
|
import (
|
2026-05-10 02:13:42 +02:00
|
|
|
"github.com/mhsanaei/3x-ui/v3/web/service"
|
2023-05-20 20:29:28 +04:30
|
|
|
)
|
|
|
|
|
|
2025-09-20 09:35:50 +02:00
|
|
|
// CheckHashStorageJob periodically cleans up expired hash entries from the Telegram bot's hash storage.
|
2023-05-20 20:29:28 +04:30
|
|
|
type CheckHashStorageJob struct {
|
|
|
|
|
tgbotService service.Tgbot
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-20 09:35:50 +02:00
|
|
|
// NewCheckHashStorageJob creates a new hash storage cleanup job instance.
|
2023-05-20 20:29:28 +04:30
|
|
|
func NewCheckHashStorageJob() *CheckHashStorageJob {
|
|
|
|
|
return new(CheckHashStorageJob)
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-20 09:35:50 +02:00
|
|
|
// Run removes expired hash entries from the Telegram bot's hash storage.
|
2023-05-20 20:29:28 +04:30
|
|
|
func (j *CheckHashStorageJob) Run() {
|
|
|
|
|
// Remove expired hashes from storage
|
|
|
|
|
j.tgbotService.GetHashStorage().RemoveExpiredHashes()
|
|
|
|
|
}
|