-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
models/migrations/v1_25/v322.go
Outdated
|
||
func AddWebhookPayloadOptimizationColumns(x *xorm.Engine) error { | ||
type Webhook struct { | ||
MetaSettings string `xorm:"meta_settings TEXT"` |
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.
XORM natively supports JSON type IIRC
} | ||
|
||
// getPayloadConfigLimit extracts the "limit" integer value from a payload config map | ||
func getPayloadConfigLimit(m map[string]any) int { |
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.
It seems fragile, I don't think we need these tricks to parse form input
"files": map[string]any{ | ||
"enable": true, | ||
"limit": 2, | ||
}, |
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.
What does "enable" mean?
If "enable=false", then "no files" or "no commits"? Or "enable=false" means "disable the limit"?
Co-authored-by: wxiaoguang <[email protected]> Signed-off-by: Kerwin Bryant <[email protected]>
…win612/gitea into kerwin612-feature/webhook-payload-optimization
…win612/gitea into kerwin612-feature/webhook-payload-optimization
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.
JS changes look reasonable
Actually no, there are other webhook pages like The code is still fragile and needs to be improved (not only JS, but also the problems I commented above) |
But it's matching on |
All webhook pages use the same template. All pages need the JS. |
Hmm, we should probably split the webhook settings template into two files with distinct classes, possibly sharing parts via subtemplates. |
BTW instead of these class queries, checking the URL would be more accurate and not have issues when templates are re-used. |
They already used shared templates. The
I believe "checking the URL" is more fragile and infeasible. Actually our
And it also helps #35129 (comment) to make code more maintainable and readable.
|
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.
