Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redis v2 engine due to the performance issue #224

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ teardown:
@bash scripts/teardown.sh

test:
- cd scripts/spanner && docker-compose up --force-recreate -d && cd ../..
@sh scripts/run-test.sh
- cd scripts/spanner && docker-compose down && cd ../..

lint:
@rm -rf lint.log
Expand Down
13 changes: 0 additions & 13 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ type RedisConf struct {
MasterName string
Version string
SentinelPassword string

EnableSecondaryStorage bool

// number of seconds. when job's delay second is greater than pumpStorageThresh,
// it will be written to storage if enabled
SecondaryStorageThresholdSeconds int64
}

func (c *Config) HasSecondaryStorage() bool {
return c.SecondaryStorage != nil
}

func (rc *RedisConf) validate() error {
Expand All @@ -104,9 +94,6 @@ func (rc *RedisConf) validate() error {
if rc.DB < 0 {
return errors.New("the pool db must be greater than 0 or equal to 0")
}
if rc.EnableSecondaryStorage && rc.SecondaryStorageThresholdSeconds < minSecondaryStorageThresholdSeconds {
return errors.New("write to secondary storage threshold required at least 1 hour")
}
return nil
}

Expand Down
6 changes: 0 additions & 6 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,4 @@ func TestRedisConfig_Validate(t *testing.T) {
if err := conf.validate(); err != nil {
t.Fatalf("no error was expected, but got %v", err)
}

conf.EnableSecondaryStorage = true
conf.SecondaryStorageThresholdSeconds = 10
if err := conf.validate(); err == nil {
t.Fatalf("validate addr error was expected, but got nil")
}
}
30 changes: 0 additions & 30 deletions engine/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import (
"encoding/binary"
"encoding/json"
"errors"
"google.golang.org/protobuf/proto"

"github.com/bitleak/lmstfy/engine/model"
"github.com/bitleak/lmstfy/uuid"
)

Expand Down Expand Up @@ -51,26 +49,6 @@ type jobImpl struct {
_elapsedMS int64
}

// NewJobFromReq creates a new job with its body and attributes being marshalled
func NewJobFromReq(req *CreateJobReq) Job {
if req.ID == "" {
req.ID = uuid.GenUniqueJobIDWithDelay(req.Delay)
}
jobData, err := marshalJobBody(req.Body, req.Attributes)
if err != nil {
return &jobImpl{}
}
return &jobImpl{
namespace: req.Namespace,
queue: req.Queue,
id: req.ID,
body: jobData,
ttl: req.TTL,
delay: req.Delay,
tries: req.Tries,
}
}

// NOTE: there is a trick in this factory, the delay is embedded in the jobID.
// By doing this we can delete the job that's located in hourly AOF, by placing
// a tombstone record in that AOF.
Expand Down Expand Up @@ -229,11 +207,3 @@ func (j *jobImpl) MarshalText() (text []byte, err error) {
func (j *jobImpl) GetDelayHour() uint16 {
return 0
}

func marshalJobBody(body []byte, attrs map[string]string) ([]byte, error) {
job := &model.JobData{
Data: body,
Attributes: attrs,
}
return proto.Marshal(job)
}
162 changes: 0 additions & 162 deletions engine/model/job.pb.go

This file was deleted.

10 changes: 0 additions & 10 deletions engine/redis_v2/constant.go

This file was deleted.

Loading
Loading