[perf] Stagger stack-hack scans to smooth second-update load#3213
Open
Xekep wants to merge 3 commits intoPryaxis:general-develfrom
Open
[perf] Stagger stack-hack scans to smooth second-update load#3213Xekep wants to merge 3 commits intoPryaxis:general-develfrom
Xekep wants to merge 3 commits intoPryaxis:general-develfrom
Conversation
Run stack detection checks only when the per-player interval is due, then evaluate permissions, instead of checking permissions every second. Initialize LastStackDetectionCheck with a per-index offset so expensive stack scans are distributed across seconds rather than spiking simultaneously.
Member
|
@greptile review |
Contributor
Greptile SummaryImplements performance optimization by throttling stack-hack detection from every second to 5-second intervals per player, with staggered initialization to distribute load. Key Changes:
Critical Issue:
Confidence Score: 2/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[OnSecondUpdate fires every second] --> B{ServerSideCharacter check}
B -->|Pass: !SSC OR SSC && IsLoggedIn| C{Check: 5s elapsed since LastStackDetectionCheck?}
B -->|Fail| E
C -->|Yes: stackCheckDue = true| D[Update LastStackDetectionCheck = Now]
C -->|No: < 5s elapsed| E
D --> F{Has ignorestackhackdetection permission?}
F -->|No| G[Run HasHackedItemStacks]
F -->|Yes: skip check| E
G --> H[Set IsDisabledForStackDetection]
H --> E{IsBeingDisabled?}
E -->|Yes| I[Call player.Disable]
E -->|No| J[End]
I --> J
style C fill:#90EE90
style E fill:#FFB6C6
style I fill:#FFB6C6
Last reviewed commit: a6c6918 |
Comment on lines
+1235
to
1238
| if (player.IsBeingDisabled()) | ||
| { | ||
| player.Disable(flags: flags); | ||
| } |
Contributor
There was a problem hiding this comment.
player.Disable() now runs outside the ServerSideCharacter check, changing original behavior. Previously only disabled when !Main.ServerSideCharacter || (Main.ServerSideCharacter && player.IsLoggedIn), now runs unconditionally.
Move this block inside the closing brace at line 1233:
Suggested change
| if (player.IsBeingDisabled()) | |
| { | |
| player.Disable(flags: flags); | |
| } | |
| } | |
| if (player.IsBeingDisabled()) | |
| { | |
| player.Disable(flags: flags); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scope