mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6924] [CLOSED] feat(xray): add scheduled periodic core restart in settings #6525
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6525
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6924
Author: @Pejman-Yousefi-Official
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:feat/xray-scheduled-restart📝 Commits (3)
0c15aa5feat(xray): add scheduled periodic core restart in settingsb8c73c9fix(xray): force core restart, validate schedule, and guard min interval034dbfdstyle: format Go files with gofumpt📊 Changes
31 files changed (+393 additions, -16 deletions)
View changed files
📝
docs/public/openapi.json(+18 -2)📝
frontend/public/openapi.json(+18 -2)📝
frontend/src/generated/examples.ts(+6 -2)📝
frontend/src/generated/schemas.ts(+18 -2)📝
frontend/src/generated/types.ts(+4 -0)📝
frontend/src/generated/zod.ts(+4 -0)📝
frontend/src/models/setting.ts(+2 -0)📝
frontend/src/pages/settings/GeneralTab.tsx(+28 -0)📝
frontend/src/pages/settings/NotifyTimeField.tsx(+22 -4)📝
frontend/src/schemas/setting.ts(+2 -0)📝
internal/web/controller/setting.go(+14 -0)📝
internal/web/entity/check_valid_test.go(+40 -0)📝
internal/web/entity/entity.go(+13 -1)➕
internal/web/job/xray_periodic_restart_job.go(+37 -0)➕
internal/web/job/xray_periodic_restart_job_test.go(+63 -0)📝
internal/web/service/setting.go(+18 -0)📝
internal/web/translation/ar-EG.json(+4 -0)📝
internal/web/translation/en-US.json(+4 -0)📝
internal/web/translation/es-ES.json(+4 -0)📝
internal/web/translation/fa-IR.json(+4 -0)...and 11 more files
📄 Description
Summary
Adds a configurable scheduled/periodic restart option for the Xray core under Panel Settings -> General, utilizing the panel's modular cron scheduler and schedule picker.
Why
In high-load production servers or networks experiencing connection decay, memory leaks in upstream protocols, or stale DNS/routing sockets, periodically restarting the Xray core (e.g. daily at off-peak hours or weekly) helps maintain optimum performance and connection stability without requiring manual administrator intervention or external system cron jobs.
Type of change
Areas affected
How was this tested?
internal/web/service/setting_xray_restart_test.goverifying factory defaults (false,@daily) and persistence ofxrayPeriodicRestartEnableandxrayPeriodicRestartCron.internal/web/job/xray_periodic_restart_job_test.goverifying safe non-panicking execution ofXrayPeriodicRestartJob.TestGetFactoryDefaultsInvariantpasses and respects tag contracts.reloadXrayPeriodicRestartFuncwithout requiring a panel daemon restart.go run ./tools/openapigenandnpm run gen:apito sync OpenAPI schema.NotifyTimeField) in General settings.npm run lint(0 warnings, 0 errors) andnpm run typecheck(tsc --noEmit).Breaking changes
None. Disabled by default (
xrayPeriodicRestartEnable = false), fully backward-compatible with existing databases.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.