When reading from or writing to channel, select should always be used to prevent a forever block:

func WaitForEvent(ctx context.Context, events chan int) {
	select {
	case <-events:
		// process event
		return
	case <-ctx.Done(): // This is eseential
		return
	}
}

Same applies to writing to a channel:

func (p *Published) PublishEvents(ctx context.Context, number int) {
	select {
	case p.events <- number:
		return
	case <-ctx.Done(): // This is eseential, even when writing to a channel
		return
	}
}

https://github.com/waku-org/go-waku/pull/1183