Skip to content

Commit

Permalink
[bugfix] Suppress 'errNoEntries' warnings from InboxForwarding functi…
Browse files Browse the repository at this point in the history
…on call (#2102)
  • Loading branch information
tsmethurst authored Aug 11, 2023
1 parent dc99e9e commit a1768a8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/federation/federatingactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"net/url"
"strings"

errorsv2 "codeberg.org/gruf/go-errors/v2"
"codeberg.org/gruf/go-kv"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
Expand Down Expand Up @@ -223,14 +224,21 @@ func (f *federatingActor) PostInboxScheme(ctx context.Context, w http.ResponseWr
// is in the database.
//
// Since our `Exists()` function currently *always*
// returns false, it will *always* attempt to insert
// the Activity. Therefore, we ignore AlreadyExists
// errors.
// returns false, it will *always* attempt to parse
// out and insert the Activity, trying to fetch other
// items from the DB in the process, which may or may
// not exist yet. Therefore, we should expect some
// errors coming from this function, and only warn log
// on certain ones.
//
// This check may be removed when the `Exists()` func
// is updated, and/or federating callbacks are handled
// properly.
if !errors.Is(err, db.ErrAlreadyExists) {
if !errorsv2.Comparable(
err,
db.ErrAlreadyExists,
db.ErrNoEntries,
) {
// Failed inbox forwarding is not a show-stopper,
// and doesn't even necessarily denote a real error.
l.Warnf("error calling sideEffectActor.InboxForwarding: %q", err)
Expand Down

0 comments on commit a1768a8

Please sign in to comment.