Skip to content

Commit

Permalink
Add migration command in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
hibiken committed Jun 29, 2021
1 parent bf54621 commit 99c7ebe
Show file tree
Hide file tree
Showing 6 changed files with 423 additions and 14 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Server` API has changed. Renamed `Quiet` to `Stop`. Renamed `Stop` to `Shutdown`. _Note:_ As a result of this renaming, the behavior of `Stop` has changed. Please update the exising code to call `Shutdown` where it used to call `Stop`.
- `Scheduler` API has changed. Renamed `Stop` to `Shutdown`.
- Requires redis v4.0+ for multiple field/value pair support
- Renamed pending key (TODO: need migration script)
- `Client.Enqueue` now returns `TaskInfo`
- `Inspector.RunTaskByKey` is replaced with `Inspector.RunTask`
- `Inspector.DeleteTaskByKey` is replaced with `Inspector.DeleteTask`
Expand Down
4 changes: 2 additions & 2 deletions internal/rdb/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ else
end
end
local unique_key = redis.call("HGET", KEYS[1], "unique_key")
if unique_key ~= nil and unique_key ~= "" and redis.call("GET", unique_key) == ARGV[1] then
if unique_key and unique_key ~= "" and redis.call("GET", unique_key) == ARGV[1] then
redis.call("DEL", unique_key)
end
return redis.call("DEL", KEYS[1])
Expand Down Expand Up @@ -1094,7 +1094,7 @@ local ids = redis.call("ZRANGE", KEYS[1], 0, -1)
for _, id in ipairs(ids) do
local task_key = ARGV[1] .. id
local unique_key = redis.call("HGET", task_key, "unique_key")
if unique_key ~= nil and unique_key ~= "" and redis.call("GET", unique_key) == id then
if unique_key and unique_key ~= "" and redis.call("GET", unique_key) == id then
redis.call("DEL", unique_key)
end
redis.call("DEL", task_key)
Expand Down
5 changes: 5 additions & 0 deletions internal/rdb/rdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (r *RDB) Close() error {
return r.client.Close()
}

// Client returns the reference to underlying redis client.
func (r *RDB) Client() redis.UniversalClient {
return r.client
}

// Ping checks the connection with redis server.
func (r *RDB) Ping() error {
return r.client.Ping().Err()
Expand Down
Loading

0 comments on commit 99c7ebe

Please sign in to comment.