You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Consider using constants for the magic numbers 5 and 6 to improve code readability and maintainability. Define these constants with meaningful names at the package level.
+const (+ appRunningState = 5+ appPausedState = 6+)+
pc := make([]uintptr, 10)
n := runtime.Callers(2, pc)
frames := runtime.CallersFrames(pc[:n])
for {
frame, more := frames.Next()
if strings.Contains(frame.Function, "changeDatabaseVersionValidate") {
- return 5, nil+ return appRunningState, nil
}
if !more {
break
}
}
// Default to appPaused for all other cases
-return 6, nil //nolint:mnd+return appPausedState, nil
Suggestion importance[1-10]: 7
__
Why: Using constants for magic numbers (5 and 6) improves code readability and maintainability. This suggestion enhances code quality by making the meaning of these values clearer and easier to update if needed.
I appreciate this PR's ingenuity :P but I suspect this is going to haunt us forever. I think it might be better to just return state 0 (there is no state as there is no app) and treat state 0 accordingly where needed.
dbm03
changed the title
chore: mock paused app state to downsize postgres storage capacity
chore: mock empty app state to downsize postgres storage capacity
Apr 14, 2025
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
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.
PR Type
Enhancement, Bug fix
Description
Mock app state based on caller function
Return paused state (6) by default
Return running state (5) for database version change
Implement runtime caller inspection for state determination
Changes walkthrough 📝
querier.go
Implement dynamic app state mocking based on callercmd/configserver/querier.go