-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add webhook payload size optimization options #35129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add webhook payload size optimization options #35129
Conversation
It should be more flexible to use "limit number" instead of "bool" |
f249f67
to
47c395d
Compare
47c395d
to
5472d66
Compare
|
5e828e9
to
258d8ee
Compare
81f8006
to
f30ad48
Compare
f30ad48
to
b718c54
Compare
b1d8892
to
655bfcd
Compare
} | ||
} | ||
|
||
export function initRepoSettingsWebhook(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic is almost the same as the code touched in "Add toggleClass function in dom.ts (#34063)": use checkbox or radio input to toggle some elements, enable some while disable others .
type MetaSettings struct { | ||
PayloadOptimization *PayloadOptimizationConfig `json:"payload_optimization,omitempty"` // Payload optimization configuration | ||
} | ||
|
||
// PayloadOptimizationConfig represents the configuration for webhook payload optimization | ||
type PayloadOptimizationConfig struct { | ||
Files *PayloadOptimizationItem `json:"files,omitempty"` // Files optimization config | ||
Commits *PayloadOptimizationItem `json:"commits,omitempty"` // Commits optimization config | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All pointers can be replaced by the struct, then no need to do any nil check.
And, JSON default values work this way:
s := SomeStruct{ default values }
json.Unmarshal(str, &s)
// then s still keeps the default values if there is no related key in the JSON str
} | ||
|
||
// PayloadOptimizationItem represents a single optimization item configuration | ||
type PayloadOptimizationItem struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization
reads strange. Optimization
means "improve something while keep the result the same as before"
Here it is likely just a "config" system.
This PR adds webhook payload size optimization options to help reduce payload size for large commits or pushes with many commits. This feature is particularly useful for target URLs that restrict payload size or have performance problems handling large JSON parsing.
