diff --git a/pkg/plug/source.go b/pkg/plug/source.go index 6a19228..7afbd22 100644 --- a/pkg/plug/source.go +++ b/pkg/plug/source.go @@ -14,7 +14,7 @@ func upsertSource(ctx context.Context, source models.Source) (models.Source, err var err error - source, err = database.GetSourceByDomain(ctx, source.Domain) + localSource, err := database.GetSourceByDomain(ctx, source.Domain) if err != nil { if err.Error() == "Database error: NoDataFound" { span.AddEvent("No Source found, initializing source") @@ -32,6 +32,8 @@ func upsertSource(ctx context.Context, source models.Source) (models.Source, err span.AddEvent("Source created") log.WithContext(ctx).WithError(err).WithField("source_domain", source.Domain).WithField("source_id", source.ID).Info("Source created!") + return source, nil + } else { span.RecordError(err) span.SetStatus(codes.Error, err.Error()) @@ -40,5 +42,5 @@ func upsertSource(ctx context.Context, source models.Source) (models.Source, err } } - return source, nil + return localSource, nil }