Skip to content

Commit

Permalink
add namespace to redis keys
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed Dec 22, 2022
1 parent 1e9e8d4 commit e80bae3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/go-redis/redis/v8"
)

const redisNamespace = "boomerang"
var (
ErrUnexpectedReturnCodeFromRedis = errors.New("unexpected return code from redis")
ErrTaskAlreadyExists = errors.New("task already exists")
Expand Down Expand Up @@ -378,9 +379,9 @@ func (s *ScheduleImpl) On(ctx context.Context, kind string, handler func(ctx con
}

func (s *ScheduleImpl) taskDataKey(kind string) string {
return fmt.Sprintf("data:%s", kind)
return fmt.Sprintf("%s:data:%s", redisNamespace, kind)
}

func (s *ScheduleImpl) taskScheduleKey(kind string) string {
return fmt.Sprintf("schedule:%s", kind)
return fmt.Sprintf("%s:schedule:%s", redisNamespace, kind)
}

0 comments on commit e80bae3

Please sign in to comment.