mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-03-01 01:20:49 +03:00

* Reduce outage time on Xray errors * Improved logs clearing, added previous logs File name change: 3xipl-access-persistent.log -> 3xipl-ap.log All previous logs have .prev suffix * Preparations for tgbot additions * [tgbot] Improvements, Additions and Fixes * Changed interaction with Expire Date for Clients * Added more info and interactions with Online Clients * Added a way to get Ban Logs (also added them to backup) * Few fixes and optimizations in code * Fixed RU translation * [tgbot] More updates and fixes * [tgbot] Quick Fix * [tgbot] Quick Fix 2 * [tgbot] Big Updates Added Notifications for Clients throught Tgbot (when Expire) Added compability for Usernames both w/wo @ Added more buttons overall for admins * [tgbot] Fixes * [tbot] Fixes 2 * [tgbot] Removed usernames support for Notifications to work * [tgbot] Fix * [tgbot] Fix Notify * [tgbot] small fixes * [tgbot] replyMarkup only for last message on big messages * [tgbot] Fixed last message is empty * [tgbot] Fix messages split
33 lines
564 B
Go
33 lines
564 B
Go
package job
|
|
|
|
import (
|
|
"x-ui/logger"
|
|
"x-ui/web/service"
|
|
)
|
|
|
|
type CheckXrayRunningJob struct {
|
|
xrayService service.XrayService
|
|
|
|
checkTime int
|
|
}
|
|
|
|
func NewCheckXrayRunningJob() *CheckXrayRunningJob {
|
|
return new(CheckXrayRunningJob)
|
|
}
|
|
|
|
func (j *CheckXrayRunningJob) Run() {
|
|
if j.xrayService.IsXrayRunning() {
|
|
j.checkTime = 0
|
|
} else {
|
|
j.checkTime++
|
|
//only restart if it's down 2 times in a row
|
|
if j.checkTime > 1 {
|
|
err := j.xrayService.RestartXray(false)
|
|
j.checkTime = 0
|
|
if err != nil {
|
|
logger.Error("Restart xray failed:", err)
|
|
}
|
|
}
|
|
}
|
|
}
|