Skip to content

Commit 94210c7

Browse files
authored
go/pubsub: handle nil static cfg (#2297)
1 parent cec8064 commit 94210c7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

runtimes/go/pubsub/topic.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func newTopic[T any](mgr *Manager, name string, cfg TopicConfig) *Topic[T] {
3636
if mgr.static.Testing {
3737
return &Topic[T]{
3838
appCfg: cfg,
39+
staticCfg: mgr.static.PubsubTopics[name],
3940
mgr: mgr,
4041
runtimeCfg: &config.PubsubTopic{EncoreName: name},
4142
topic: test.NewTopic[T](mgr.ts, name),
@@ -165,16 +166,19 @@ func (t *Topic[T]) Publish(ctx context.Context, msg T) (id string, err error) {
165166
curr := t.mgr.rt.Current()
166167
var startEventID trace2.EventID
167168
if curr.Req != nil && curr.Trace != nil {
169+
desc := &model.PubSubTopicDesc{
170+
Topic: t.runtimeCfg.EncoreName,
171+
}
172+
if t.staticCfg != nil {
173+
desc.ScrubPaths = t.staticCfg.ScrubPaths
174+
}
168175
startEventID = curr.Trace.PubsubPublishStart(trace2.PubsubPublishStartParams{
169176
EventParams: trace2.EventParams{
170177
TraceID: curr.Req.TraceID,
171178
SpanID: curr.Req.SpanID,
172179
Goid: curr.Goctr,
173180
},
174-
Desc: &model.PubSubTopicDesc{
175-
Topic: t.runtimeCfg.EncoreName,
176-
ScrubPaths: t.staticCfg.ScrubPaths,
177-
},
181+
Desc: desc,
178182
Message: data,
179183
Stack: stack.Build(1),
180184
})

0 commit comments

Comments
 (0)