mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #3603] [MERGED] fix: handle CPU threshold error to prevent false notifications #5477
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#5477
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/3603
Author: @kotopheiop
Created: 12/12/2025
Status: ✅ Merged
Merged: 12/12/2025
Merged by: @MHSanaei
Base:
main← Head:fix/cpu-threshold-error-handling📝 Commits (1)
f40278efix: handle CPU threshold error to prevent false notifications📊 Changes
1 file changed (+5 additions, -1 deletions)
View changed files
📝
web/job/check_cpu_usage.go(+5 -1)📄 Description
This PR fixes a bug in the CPU monitoring job where Telegram notifications were being sent with incorrect threshold values (showing 0% instead of the configured threshold).
Previously, when
GetTgCpu()failed, the error was ignored and threshold defaulted to 0, causing notifications to be sent for any CPU usage.Now the job properly checks for errors and skips notifications if:
This ensures notifications are only sent when CPU usage exceeds the configured threshold value from settings.
Which part of the application is affected by the change?
Type of Changes
Screenshots
Additional Notes
Problem:
Users were receiving Telegram notifications showing "CPU load exceeds threshold value 0%" even though they had configured a different threshold value (e.g., 85%) in the settings.
Root Cause:
In
CheckCpuJob.Run(), the error fromGetTgCpu()was ignored usingthreshold, _ := .... When an error occurred, the threshold defaulted to 0, causing the conditionpercent[0] > float64(threshold)to be true for any positive CPU usage.Solution:
GetTgCpu()callTesting:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.