Skip to content

Commit

Permalink
Fix line with wrong variable add extra guard and optimization
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
  • Loading branch information
jnmoyne authored and wallyqs committed Jan 11, 2024
1 parent 6a41e96 commit f14c62b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3382,11 +3382,12 @@ func (mset *stream) setStartingSequenceForSources(iNames map[string]struct{}) {
delete(iNames, indexName)
} else if indexName == _EMPTY_ && streamName != _EMPTY_ {
for iName := range iNames {
if streamName == mset.sources[iName].name ||
(mset.streamSource(iName).External != nil && streamName == mset.sources[iName].name+":"+getHash(mset.streamSource(iName).External.ApiPrefix)) {
si := mset.sources[indexName]
// TODO streamSource is a linear walk, to optimize later
if si := mset.sources[iName]; si != nil && streamName == si.name ||
(mset.streamSource(iName).External != nil && streamName == si.name+":"+getHash(mset.streamSource(iName).External.ApiPrefix)) {
si.sseq = sseq
si.dseq = 0
delete(iNames, iName)
break
}
}
Expand Down

0 comments on commit f14c62b

Please sign in to comment.