aboutsummaryrefslogtreecommitdiff
path: root/weed/notification/webhook/webhook_queue.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/notification/webhook/webhook_queue.go')
-rw-r--r--weed/notification/webhook/webhook_queue.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/weed/notification/webhook/webhook_queue.go b/weed/notification/webhook/webhook_queue.go
index d8f9a0734..f5853dc2d 100644
--- a/weed/notification/webhook/webhook_queue.go
+++ b/weed/notification/webhook/webhook_queue.go
@@ -196,7 +196,21 @@ func (w *Queue) logDeadLetterMessages() error {
for {
select {
case msg := <-ch:
- glog.Errorf("received dead letter message: %s, key: %s", string(msg.Payload), msg.Metadata["key"])
+ if msg == nil {
+ glog.Errorf("received nil message from dead letter channel")
+ continue
+ }
+ key := "unknown"
+ if msg.Metadata != nil {
+ if keyValue, exists := msg.Metadata["key"]; exists {
+ key = keyValue
+ }
+ }
+ payload := ""
+ if msg.Payload != nil {
+ payload = string(msg.Payload)
+ }
+ glog.Errorf("received dead letter message: %s, key: %s", payload, key)
case <-w.ctx.Done():
return
}