Skip to content

Commit

Permalink
fix delay header
Browse files Browse the repository at this point in the history
  • Loading branch information
withinboredom committed Mar 11, 2024
1 parent a4faaa1 commit fce454a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Binary file modified bin/dphp-linux-x86_64
Binary file not shown.
2 changes: 1 addition & 1 deletion cli/lib/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func BuildConsumer(stream jetstream.Stream, ctx context.Context, streamName stri
meta, _ := msg.Metadata()
headers := msg.Headers()

if headers.Get("Delay") != "" && meta.NumDelivered == 1 {
if headers.Get(string(HeaderDelay)) != "" && meta.NumDelivered == 1 {
logger.Debug("Delaying message", zap.String("delay", msg.Headers().Get("Delay")), zap.Any("Headers", meta))
schedule, err := time.Parse(time.RFC3339, msg.Headers().Get("Delay"))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/response_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (w *InternalLoggingResponseWriter) Write(b []byte) (int, error) {
}

if body.ScheduleAt.After(time.Now()) {
msg.Header.Add(string(HeaderDelay), body.ScheduleAt.String())
msg.Header.Add(string(HeaderDelay), body.ScheduleAt.Format(time.RFC3339))
}

w.events = append(w.events, msg)
Expand Down

0 comments on commit fce454a

Please sign in to comment.