Skip to content

Commit

Permalink
sync: minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Feb 1, 2025
1 parent f708a8d commit 33b48c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions std/sync/svs_alo.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ func (s *SvsALO) deliver(out svsPubOut) {
}

// Commit the successful delivery
hash := out.pub.Publisher.String()
prev := s.delivered.Get(hash, out.pub.BootTime)
prev := s.delivered.Get(out.hash, out.pub.BootTime)
if out.pub.SeqNum > prev {
s.delivered.Set(hash, out.pub.BootTime, out.pub.SeqNum)
s.delivered.Set(out.hash, out.pub.BootTime, out.pub.SeqNum)
}
}
6 changes: 5 additions & 1 deletion std/sync/svs_alo_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type seqFetchState struct {
}

type svsPubOut struct {
hash string
pub SvsPub
subs []func(SvsPub)
}
Expand Down Expand Up @@ -149,6 +150,9 @@ func (s *SvsALO) consumeObject(node enc.Name, boot uint64, seq uint64) {
// it's okay to delete all the pending data.
delete(entry.PendingData, nextSeq)
deliver = append(deliver, pub)

// Only updating the local copy of the state
// The state will be updated only after finding some subs.
entry.Known = nextSeq
}

Expand All @@ -165,7 +169,7 @@ func (s *SvsALO) consumeObject(node enc.Name, boot uint64, seq uint64) {
// we WILL deliver it, update known state
s.state.Set(hash, boot, entry)
for _, pub := range deliver {
s.outpipe <- svsPubOut{pub, subs}
s.outpipe <- svsPubOut{hash, pub, subs}
}
}

Expand Down

0 comments on commit 33b48c4

Please sign in to comment.