Skip to content

Commit

Permalink
handle the case when ttl is 0 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adib Rastegarnia committed May 14, 2020
1 parent 53fed68 commit 2b25193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/atomix/map/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ package _map //nolint:golint

import (
"bytes"
"io"

"github.com/atomix/go-framework/pkg/atomix/node"
"github.com/atomix/go-framework/pkg/atomix/service"
"github.com/atomix/go-framework/pkg/atomix/stream"
"github.com/atomix/go-framework/pkg/atomix/util"
"github.com/golang/protobuf/proto"
"io"
)

func init() {
Expand Down Expand Up @@ -436,7 +437,7 @@ func (m *Service) Entries(value []byte, stream stream.WriteStream) {

func (m *Service) scheduleTTL(key string, value *MapEntryValue) {
m.cancelTTL(key)
if value.TTL != nil {
if value.TTL != nil && *value.TTL > 0 {
m.timers[key] = m.Scheduler.ScheduleOnce(value.Created.Add(*value.TTL).Sub(m.Context.Timestamp()), func() {
delete(m.entries, key)
m.sendEvent(&ListenResponse{
Expand Down

0 comments on commit 2b25193

Please sign in to comment.