+1
appview/state/state.go
+1
appview/state/state.go
+8
-1
knotserver/jetstream.go
+8
-1
knotserver/jetstream.go
···
47
47
jc := &JetstreamClient{
48
48
cfg: cfg,
49
49
client: client,
50
-
reconnectCh: make(chan struct{}),
50
+
reconnectCh: make(chan struct{}, 1),
51
51
}
52
52
53
53
h.jc = jc
···
78
78
}
79
79
}
80
80
}
81
+
}
82
+
83
+
func (j *JetstreamClient) AddDid(did string) {
84
+
j.mu.Lock()
85
+
j.cfg.WantedDids = append(j.cfg.WantedDids, did)
86
+
j.mu.Unlock()
87
+
j.reconnectCh <- struct{}{}
81
88
}
82
89
83
90
func (j *JetstreamClient) UpdateDids(dids []string) {
+2
-2
knotserver/routes.go
+2
-2
knotserver/routes.go
···
484
484
return
485
485
}
486
486
487
-
h.jc.UpdateDids([]string{did})
487
+
h.jc.AddDid(did)
488
488
if err := h.e.AddMember(ThisServer, did); err != nil {
489
489
l.Error("adding member", "error", err.Error())
490
490
writeError(w, err.Error(), http.StatusInternalServerError)
···
520
520
writeError(w, err.Error(), http.StatusInternalServerError)
521
521
return
522
522
}
523
-
h.jc.UpdateDids([]string{data.Did})
523
+
h.jc.AddDid(data.Did)
524
524
525
525
repoName := filepath.Join(ownerDid, repo)
526
526
if err := h.e.AddRepo(data.Did, ThisServer, repoName); err != nil {