diff --git a/engine/pubsub.go b/engine/pubsub.go index 842593bfb..9ec56581c 100644 --- a/engine/pubsub.go +++ b/engine/pubsub.go @@ -122,6 +122,7 @@ func (ps *PubSub) Unsubscribe(si SubscribeInfo, reply *string) error { func (ps *PubSub) Publish(evt CgrEvent, reply *string) error { ps.mux.Lock() defer ps.mux.Unlock() + evt["Timestamp"] = time.Now().Format(time.RFC3339Nano) for key, subData := range ps.subscribers { if !subData.ExpTime.IsZero() && subData.ExpTime.Before(time.Now()) { delete(ps.subscribers, key) diff --git a/engine/pubsub_test.go b/engine/pubsub_test.go index 470553b3d..803409e1d 100644 --- a/engine/pubsub_test.go +++ b/engine/pubsub_test.go @@ -137,7 +137,7 @@ func TestPublish(t *testing.T) { t.Error("Error publishing: ", err) } for i := 0; i < 1000; i++ { // wait for the theread to populate map - if len(m) == 1 { + if len(m) == 2 { time.Sleep(time.Microsecond) } else { break