Include unique id and timestamp with webhook events (#291)

Resolves #230
This commit is contained in:
David Zhao
2021-12-27 23:33:06 -08:00
committed by GitHub
parent 15cd98be22
commit 87a799bae2
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -6,6 +6,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/webhook"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -201,6 +202,9 @@ func (t *telemetryService) notifyEvent(ctx context.Context, event *livekit.Webho
return
}
event.CreatedAt = time.Now().Unix()
event.Id = utils.NewGuid("EV_")
t.webhookPool.Submit(func() {
if err := t.notifier.Notify(ctx, event); err != nil {
logger.Warnw("failed to notify webhook", err, "event", event.Event)