Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulnpdev committed Aug 8, 2024
1 parent b213d5d commit 4f5cbc9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions common/dynamicconfig/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@ func subscribe[T any](
// get one value immediately (note that subscriptionLock is held here so we can't race with
// an update)
init := matchAndConvert(c, key, def, cdef, convert, prec)

// As a convenience (and for efficiency), you can pass in a nil callback; we just return the
// current value and skip the subscription. The cancellation func returned is a no-op and
// can be called or ignored.
if reflect.ValueOf(callback).IsNil() {
if callback == nil {
return init, func() {}
}

c.subscriptionIdx++
id := c.subscriptionIdx

Expand Down

0 comments on commit 4f5cbc9

Please sign in to comment.