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