From 1a95c882ad7e3a7e064bdeb1be898c40ebdce2e8 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Thu, 5 Jul 2018 22:03:46 +0200 Subject: [PATCH] Add Published time when it is not set --- cmd/eksterd/fetch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/eksterd/fetch.go b/cmd/eksterd/fetch.go index 2b7506f..10a15d1 100644 --- a/cmd/eksterd/fetch.go +++ b/cmd/eksterd/fetch.go @@ -365,6 +365,10 @@ func (b *memoryBackend) channelAddItem(channel string, item microsub.Item) { channelKey := fmt.Sprintf("channel:%s:posts", channel) zchannelKey := fmt.Sprintf("zchannel:%s:posts", channel) + if item.Published == "" { + item.Published = time.Now().Format(time.RFC3339) + } + data, err := json.Marshal(item) if err != nil { log.Printf("error while creating item for redis: %v\n", err)