Fix execution sequence

This commit is contained in:
Wayback Archiver 2023-02-05 13:32:31 +00:00 committed by fiatjaf
parent 11f4090639
commit d7d4c62602

View File

@ -230,14 +230,13 @@ 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
}
// update status (this will be returned later)
mu.Lock()
status = PublishStatusSent
mu.Unlock()
sub := r.Subscribe(ctx, Filters{Filter{IDs: []string{event.ID}}})
defer mu.Unlock()
for {