diff options
author | zeripath <art27@cantab.net> | 2020-03-29 08:12:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 15:12:15 +0800 |
commit | e83daf77ade99057b61525c1f54ed3d10aec8091 (patch) | |
tree | 3edadefb3f9057f7d58a1dcdc34c72ee7df6061e /modules/queue | |
parent | 61f603cd8a74f9e4d59801bca2c3d1e44cdba304 (diff) | |
download | gitea-e83daf77ade99057b61525c1f54ed3d10aec8091.tar.gz gitea-e83daf77ade99057b61525c1f54ed3d10aec8091.zip |
Avoid logging []byte in queue failures - convert to string first (#10865)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'modules/queue')
-rw-r--r-- | modules/queue/queue_wrapped.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/queue/queue_wrapped.go b/modules/queue/queue_wrapped.go index 32c01546de..9cf32a7dea 100644 --- a/modules/queue/queue_wrapped.go +++ b/modules/queue/queue_wrapped.go @@ -64,10 +64,17 @@ func (q *delayedStarter) setInternal(atShutdown func(context.Context, func()), h break } if err.Error() != "resource temporarily unavailable" { - log.Warn("[Attempt: %d] Failed to create queue: %v for %s cfg: %#v error: %v", i, q.underlying, q.name, q.cfg, err) + if bs, ok := q.cfg.([]byte); ok { + log.Warn("[Attempt: %d] Failed to create queue: %v for %s cfg: %s error: %v", i, q.underlying, q.name, string(bs), err) + } else { + log.Warn("[Attempt: %d] Failed to create queue: %v for %s cfg: %#v error: %v", i, q.underlying, q.name, q.cfg, err) + } } i++ if q.maxAttempts > 0 && i > q.maxAttempts { + if bs, ok := q.cfg.([]byte); ok { + return fmt.Errorf("Unable to create queue %v for %s with cfg %s by max attempts: error: %v", q.underlying, q.name, string(bs), err) + } return fmt.Errorf("Unable to create queue %v for %s with cfg %#v by max attempts: error: %v", q.underlying, q.name, q.cfg, err) } sleepTime := 100 * time.Millisecond |