Skip to content

Commit

Permalink
fix: load no-ttl items in load snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
dartt0n committed Nov 18, 2023
1 parent ff13958 commit e5bb5c0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions skhron.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ func (s *Skhron[V]) LoadSnapshot() error {
s.TTLq = newExpQueue()
heap.Init(s.TTLq)

// add no-ttl items
for key, value := range rs.Data {
s.Data.Set(key, value)
}

// add ttl items
for rs.TTLq.Len() > 0 {
item := rs.TTLq.Pop().(*expireItem)
s.Data.Set(item.Key, rs.Data[item.Key])
Expand Down

0 comments on commit e5bb5c0

Please sign in to comment.