mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-02-23 05:44:23 +01:00
init subscription map if nil
This commit is contained in:
@@ -20,7 +20,9 @@ func NewPubsub() *Pubsub {
|
||||
func (ps *Pubsub) Subscribe(id string, topic int64, ch chan models.Invoice) {
|
||||
ps.mu.Lock()
|
||||
defer ps.mu.Unlock()
|
||||
|
||||
if ps.subs[topic] == nil {
|
||||
ps.subs[topic] = make(map[string]chan models.Invoice)
|
||||
}
|
||||
ps.subs[topic][id] = ch
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user