mirror of
https://github.com/goharbor/harbor
synced 2025-04-18 18:09:48 +00:00
fix: change the default max retry count for webhook job to 3 (#18392)
Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
parent
c1d297b015
commit
395ae77d64
|
@ -117,7 +117,7 @@ jobservice:
|
|||
|
||||
notification:
|
||||
# Maximum retry count for webhook job
|
||||
webhook_job_max_retry: 10
|
||||
webhook_job_max_retry: 3
|
||||
# HTTP client timeout for webhook job
|
||||
webhook_job_http_client_timeout: 3 #seconds
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ notification:
|
|||
webhook_job_http_client_timeout: 3 #seconds
|
||||
{% endif %}
|
||||
{% else %}
|
||||
webhook_job_max_retry: 10
|
||||
webhook_job_max_retry: 3
|
||||
# HTTP client timeout for webhook job
|
||||
webhook_job_http_client_timeout: 3 #seconds
|
||||
{% endif %}
|
||||
|
|
|
@ -22,9 +22,8 @@ type SlackJob struct {
|
|||
|
||||
// MaxFails returns that how many times this job can fail.
|
||||
func (sj *SlackJob) MaxFails() (result uint) {
|
||||
// Default max fails count is 10, and its max retry interval is around 3h
|
||||
// Large enough to ensure most situations can notify successfully
|
||||
result = 10
|
||||
// Default max fails count is 3
|
||||
result = 3
|
||||
if maxFails, exist := os.LookupEnv(maxFails); exist {
|
||||
mf, err := strconv.ParseUint(maxFails, 10, 32)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
func TestSlackJobMaxFails(t *testing.T) {
|
||||
rep := &SlackJob{}
|
||||
t.Run("default max fails", func(t *testing.T) {
|
||||
assert.Equal(t, uint(10), rep.MaxFails())
|
||||
assert.Equal(t, uint(3), rep.MaxFails())
|
||||
})
|
||||
|
||||
t.Run("user defined max fails", func(t *testing.T) {
|
||||
|
@ -25,7 +25,7 @@ func TestSlackJobMaxFails(t *testing.T) {
|
|||
|
||||
t.Run("user defined wrong max fails", func(t *testing.T) {
|
||||
t.Setenv(maxFails, "abc")
|
||||
assert.Equal(t, uint(10), rep.MaxFails())
|
||||
assert.Equal(t, uint(3), rep.MaxFails())
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@ type WebhookJob struct {
|
|||
|
||||
// MaxFails returns that how many times this job can fail, get this value from ctx.
|
||||
func (wj *WebhookJob) MaxFails() (result uint) {
|
||||
// Default max fails count is 10, and its max retry interval is around 3h
|
||||
// Large enough to ensure most situations can notify successfully
|
||||
result = 10
|
||||
// Default max fails count is 3
|
||||
result = 3
|
||||
if maxFails, exist := os.LookupEnv(maxFails); exist {
|
||||
mf, err := strconv.ParseUint(maxFails, 10, 32)
|
||||
if err != nil {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestMaxFails(t *testing.T) {
|
||||
rep := &WebhookJob{}
|
||||
t.Run("default max fails", func(t *testing.T) {
|
||||
assert.Equal(t, uint(10), rep.MaxFails())
|
||||
assert.Equal(t, uint(3), rep.MaxFails())
|
||||
})
|
||||
|
||||
t.Run("user defined max fails", func(t *testing.T) {
|
||||
|
@ -24,7 +24,7 @@ func TestMaxFails(t *testing.T) {
|
|||
|
||||
t.Run("user defined wrong max fails", func(t *testing.T) {
|
||||
t.Setenv(maxFails, "abc")
|
||||
assert.Equal(t, uint(10), rep.MaxFails())
|
||||
assert.Equal(t, uint(3), rep.MaxFails())
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user