forked from tangled.org/core
this repo has no description

minor tweaks, add logging

Changed files
+7 -1
appview
state
jetstream
knotserver
+1 -1
appview/state/state.go
···
jc, err := jetstream.NewJetstreamClient(
config.JetstreamEndpoint,
"appview",
-
[]string{tangled.GraphFollowNSID},
nil,
slog.Default(),
wrapper,
···
jc, err := jetstream.NewJetstreamClient(
config.JetstreamEndpoint,
"appview",
+
[]string{tangled.GraphFollowNSID, tangled.FeedStarNSID},
nil,
slog.Default(),
wrapper,
+5
jetstream/jetstream.go
···
return
}
j.mu.Lock()
j.wantedDids[did] = struct{}{}
j.mu.Unlock()
···
type processor func(context.Context, *models.Event) error
func (j *JetstreamClient) withDidFilter(processFunc processor) processor {
// since this closure references j.WantedDids; it should auto-update
// existing instances of the closure when j.WantedDids is mutated
return func(ctx context.Context, evt *models.Event) error {
···
return
}
+
j.l.Info("adding did to in-memory filter", "did", did)
j.mu.Lock()
j.wantedDids[did] = struct{}{}
j.mu.Unlock()
···
type processor func(context.Context, *models.Event) error
func (j *JetstreamClient) withDidFilter(processFunc processor) processor {
+
// empty filter => all dids allowed
+
if len(j.wantedDids) == 0 {
+
return processFunc
+
}
// since this closure references j.WantedDids; it should auto-update
// existing instances of the closure when j.WantedDids is mutated
return func(ctx context.Context, evt *models.Event) error {
+1
knotserver/handler.go
···
if err != nil {
return nil, fmt.Errorf("failed to get all Dids: %w", err)
}
if len(dids) > 0 {
h.knotInitialized = true
close(h.init)
···
if err != nil {
return nil, fmt.Errorf("failed to get all Dids: %w", err)
}
+
if len(dids) > 0 {
h.knotInitialized = true
close(h.init)