diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-04-22 20:38:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 13:38:40 +0100 |
commit | fcc8cdd446d99a822d835c6d36e8abc4b5ac42a6 (patch) | |
tree | adb30abb0d41680274b0e502df5af94490892c6c /modules/queue | |
parent | c0d71f5e264209b5fa2f7206488c49521248cea1 (diff) | |
download | gitea-fcc8cdd446d99a822d835c6d36e8abc4b5ac42a6.tar.gz gitea-fcc8cdd446d99a822d835c6d36e8abc4b5ac42a6.zip |
Improve config logging when WrappedQueue times out (#11174)
Before
```sh
Unable to set the internal queue for -wrapper Error: Timedout creating queue redis with cfg []byte{0x7b, 0x22, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0x3a, 0x22, 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31, 0x3a, 0x36, 0x33, 0x37, 0x39, 0x22, 0x2c, 0x22, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x3a, 0x32, 0x30, 0x2c, 0x22, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x3a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2c, 0x22, 0x42, 0x6f, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x3a, 0x33, 0x30, 0x30, 0x30, 0x30, 0x30
......
```
After
```sh
Unable to set the internal queue for -wrapper Error: Timedout creating queue redis with cfg "{\"Addresses\":\"127.0.0.1:6379\",\"BatchLength\":20,\"BlockTimeout\":1000000000,\"BoostTimeout\":300000000000,\"BoostWorkers\":5,\"DBIndex\":0,\"DataDir\":\".../data/queues/mail\",\"MaxWorkers\":10,\"Name\":\"mail\",\"Network\":\"\",\"Password\":\"\",\"QueueLength\":20,\"QueueName\":\"mail_queue\",\"SetName\":\"\",\"Workers\":1}" in
```
Diffstat (limited to 'modules/queue')
-rw-r--r-- | modules/queue/queue_wrapped.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/queue/queue_wrapped.go b/modules/queue/queue_wrapped.go index 9cf32a7dea..482c90a810 100644 --- a/modules/queue/queue_wrapped.go +++ b/modules/queue/queue_wrapped.go @@ -56,7 +56,11 @@ func (q *delayedStarter) setInternal(atShutdown func(context.Context, func()), h for q.internal == nil { select { case <-ctx.Done(): - return fmt.Errorf("Timedout creating queue %v with cfg %#v in %s", q.underlying, q.cfg, q.name) + var cfg = q.cfg + if s, ok := cfg.([]byte); ok { + cfg = string(s) + } + return fmt.Errorf("Timedout creating queue %v with cfg %#v in %s", q.underlying, cfg, q.name) default: queue, err := NewQueue(q.underlying, handle, q.cfg, exemplar) if err == nil { |