Skip to content

Commit

Permalink
Fixed panic on AOFSHRINK
Browse files Browse the repository at this point in the history
closes #508
  • Loading branch information
tidwall committed Nov 17, 2019
1 parent 0d0de39 commit 474ff81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/server/aofshrink.go
Expand Up @@ -98,8 +98,8 @@ func (server *Server) aofshrink() {
if value, ok := server.expires.Get(keys[0]); ok {
exm = value.(*rhh.Map)
}
var now = time.Now() // used for expiration
var count = 0 // the object count
var now = time.Now().UnixNano() // used for expiration
var count = 0 // the object count
col.ScanGreaterOrEqual(nextid, false, nil, nil,
func(id string, obj geojson.Object, fields []float64) bool {
if count == maxids {
Expand All @@ -123,7 +123,7 @@ func (server *Server) aofshrink() {
}
if exm != nil {
if at, ok := exm.Get(id); ok {
expires := at.(time.Time).Sub(now)
expires := at.(int64) - now
if expires > 0 {
values = append(values, "ex")
values = append(values, strconv.FormatFloat(math.Floor(float64(expires)/float64(time.Second)*10)/10, 'f', -1, 64))
Expand Down

0 comments on commit 474ff81

Please sign in to comment.