From a16e2a28d5fb8e7d279cf2dc2c1e84966c67af20 Mon Sep 17 00:00:00 2001 From: Wayback Archiver <66856220+waybackarchiver@users.noreply.github.com> Date: Sun, 5 Feb 2023 13:44:26 +0000 Subject: [PATCH] Update relay.go --- relay.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/relay.go b/relay.go index ad51421..e27cdba 100644 --- a/relay.go +++ b/relay.go @@ -197,7 +197,7 @@ func (r *Relay) Connect(ctx context.Context) error { // Publish sends an "EVENT" command to the relay r as in NIP-01. // Status can be: success, failed, or sent (no response from relay before ctx times out). func (r *Relay) Publish(ctx context.Context, event Event) Status { - status := PublishStatusFailed + status := PublishStatusSent // data races on status variable without this mutex var mu sync.Mutex @@ -230,10 +230,6 @@ func (r *Relay) Publish(ctx context.Context, event Event) Status { // publish event if err := r.Connection.WriteJSON([]interface{}{"EVENT", event}); err != nil { - // update status (this will be returned later) - mu.Lock() - status = PublishStatusSent - mu.Unlock() return status }