1
0
Fork 0
forked from forgejo/forgejo

Mirror System Notice reports are too frequent (#12438)

This PR switches off the success reports from the Update Mirrors cron job
as they are too frequent and not necessarily helpful.

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2020-08-05 21:40:36 +01:00 committed by GitHub
parent 42a31c797b
commit 48598a7e83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 8 deletions

View file

@ -17,13 +17,15 @@ type Config interface {
DoRunAtStart() bool
GetSchedule() string
FormatMessage(name, status string, doer *models.User, args ...interface{}) string
DoNoticeOnSuccess() bool
}
// BaseConfig represents the basic config for a Cron task
type BaseConfig struct {
Enabled bool
RunAtStart bool
Schedule string
Enabled bool
RunAtStart bool
Schedule string
NoSuccessNotice bool
}
// OlderThanConfig represents a cron task with OlderThan setting
@ -53,6 +55,11 @@ func (b *BaseConfig) DoRunAtStart() bool {
return b.RunAtStart
}
// DoNoticeOnSuccess returns whether a success notice should be posted
func (b *BaseConfig) DoNoticeOnSuccess() bool {
return !b.NoSuccessNotice
}
// FormatMessage returns a message for the task
func (b *BaseConfig) FormatMessage(name, status string, doer *models.User, args ...interface{}) string {
realArgs := make([]interface{}, 0, len(args)+2)