Skip to content

Commit

Permalink
fix [] in outbox.sent after successful delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 6, 2024
1 parent abec346 commit 4348eef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fed/deliver.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2023 Dima Krasner
Copyright 2023, 2024 Dima Krasner
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,7 +99,7 @@ func processQueue(ctx context.Context, log *slog.Logger, db *sql.DB, resolver *R
continue
}

if err := deliverWithTimeout(ctx, log, db, resolver, &activity, []byte(activityString), &actor, time.Unix(inserted, 0), recipients); err != nil {
if err := deliverWithTimeout(ctx, log, db, resolver, &activity, []byte(activityString), &actor, time.Unix(inserted, 0), &recipients); err != nil {
log.Warn("Failed to deliver activity", "id", activity.ID, "attempts", deliveryAttempts, "error", err)
continue
}
Expand All @@ -121,13 +121,13 @@ func processQueue(ctx context.Context, log *slog.Logger, db *sql.DB, resolver *R
return nil
}

func deliverWithTimeout(parent context.Context, log *slog.Logger, db *sql.DB, resolver *Resolver, activity *ap.Activity, rawActivity []byte, actor *ap.Actor, inserted time.Time, sent ap.Audience) error {
func deliverWithTimeout(parent context.Context, log *slog.Logger, db *sql.DB, resolver *Resolver, activity *ap.Activity, rawActivity []byte, actor *ap.Actor, inserted time.Time, sent *ap.Audience) error {
ctx, cancel := context.WithTimeout(parent, deliveryTimeout)
defer cancel()
return deliver(ctx, log, db, activity, rawActivity, actor, resolver, inserted, sent)
}

func deliver(ctx context.Context, log *slog.Logger, db *sql.DB, activity *ap.Activity, rawActivity []byte, actor *ap.Actor, resolver *Resolver, inserted time.Time, received ap.Audience) error {
func deliver(ctx context.Context, log *slog.Logger, db *sql.DB, activity *ap.Activity, rawActivity []byte, actor *ap.Actor, resolver *Resolver, inserted time.Time, received *ap.Audience) error {
activityID, err := url.Parse(activity.ID)
if err != nil {
return err
Expand Down

1 comment on commit 4348eef

@dimkr
Copy link
Owner Author

@dimkr dimkr commented on 4348eef Jan 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • outbox.received, not .sent

Please sign in to comment.