PublishEvent() fixes.

This commit is contained in:
fiatjaf
2022-11-17 09:28:45 -03:00
parent 381ee2cc01
commit 480ee0ef87
3 changed files with 10 additions and 4 deletions

View File

@@ -170,7 +170,7 @@ func (r *Relay) Connect() error {
}
func (r Relay) Publish(event Event) chan Status {
statusChan := make(chan Status)
statusChan := make(chan Status, 4)
go func() {
// we keep track of this so the OK message can be used to close it
@@ -181,6 +181,7 @@ func (r Relay) Publish(event Event) chan Status {
if err != nil {
statusChan <- PublishStatusFailed
close(statusChan)
return
}
statusChan <- PublishStatusSent