Skip to content

Commit 388534e

Browse files
committed
feat: track workflow event delivery delays
1 parent 86c183a commit 388534e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

server/webhook.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"reflect"
88
"strings"
9+
"time"
910

1011
"github.com/flashbots/gh-artifacts-sync/job"
1112
"github.com/flashbots/gh-artifacts-sync/logutils"
@@ -124,6 +125,12 @@ func (s *Server) webhookProcessRegistryPackageEvent(ctx context.Context, e *gith
124125
return nil
125126
}
126127

128+
if e.Repository.PushedAt != nil && time.Since(e.Repository.PushedAt.Time) > time.Minute {
129+
l.Warn("Github event was delivered late",
130+
zap.Duration("delay", time.Since(e.Repository.PushedAt.Time)),
131+
)
132+
}
133+
127134
j := job.NewSyncContainerRegistryPackage(
128135
e.RegistryPackage,
129136
e.Repository,
@@ -174,6 +181,12 @@ func (s *Server) webhookProcessReleaseEvent(ctx context.Context, e *github.Relea
174181
return nil
175182
}
176183

184+
if e.Release.PublishedAt != nil && time.Since(e.Release.PublishedAt.Time) > time.Minute {
185+
l.Warn("Github event was delivered late",
186+
zap.Duration("delay", time.Since(e.Release.PublishedAt.Time)),
187+
)
188+
}
189+
177190
errs := make([]error, 0)
178191

179192
jobsCount := 0
@@ -296,6 +309,12 @@ func (s *Server) webhookProcessWorkflowEvent(ctx context.Context, e *github.Work
296309
return nil
297310
}
298311

312+
if e.Repo.PushedAt != nil && time.Since(e.Repo.PushedAt.Time) > time.Minute {
313+
l.Warn("Github event was delivered late",
314+
zap.Duration("delay", time.Since(e.Repo.PushedAt.Time)),
315+
)
316+
}
317+
299318
fname, err := job.Save(job.NewDiscoverWorkflowArtifacts(e), s.cfg.Dir.Jobs)
300319
if err != nil {
301320
l.Error("Failed to persist a job",

0 commit comments

Comments
 (0)