Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xh3b4sd/rescue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.17.17
Choose a base ref
...
head repository: xh3b4sd/rescue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 12 commits
  • 42 files changed
  • 2 contributors

Commits on Sep 11, 2024

  1. update go.mod (#52)

    xh3b4sd authored Sep 11, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4f0e419 View commit details

Commits on Sep 26, 2024

  1. add circuit breaker for selected tasks (#53)

    xh3b4sd authored Sep 26, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4dc6574 View commit details

Commits on Oct 7, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    91e077c View commit details

Commits on Oct 8, 2024

  1. add tests (#55)

    xh3b4sd authored Oct 8, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    460a595 View commit details

Commits on Oct 13, 2024

  1. use separate object ID package (#56)

    xh3b4sd authored Oct 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2d93e20 View commit details
  2. enable existing tasks to be deferred (#57)

    xh3b4sd authored Oct 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aee1351 View commit details

Commits on Oct 23, 2024

  1. update go.mod (#58)

    xh3b4sd authored Oct 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aaf887f View commit details
  2. update go.mod (#59)

    xh3b4sd authored Oct 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c48f78a View commit details

Commits on Nov 5, 2024

  1. update go.mod (#60)

    xh3b4sd authored Nov 5, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4573624 View commit details

Commits on Jan 27, 2025

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    86d5675 View commit details

Commits on Feb 20, 2025

  1. Bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#62)

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 20, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d259cd8 View commit details

Commits on Feb 24, 2025

  1. Bump github.com/google/go-cmp from 0.6.0 to 0.7.0 (#63)

    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Feb 24, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d298256 View commit details
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,6 +15,15 @@ type Task struct {
// task.rescue.io/object 1611318984211839461
// task.rescue.io/worker 90dc68ba-4820-42ac-a924-2450388c15a6
//
// It is possible to define an execution limit using the circuit breaker label
// Cancel. A task defining a maximum execution count will be executed at most
// Cancel times. Once the execution limit hit the task at hand will be kept on
// hold until its Cycles number is reset by some external process. This allows
// tasks to stay on queue until a resolution for the failing root cause may be
// found.
//
// task.rescue.io/cancel 5
//
Core *Core `json:"core,omitempty"`

// Cron contains optional scheduling information. A task may define to be
@@ -286,8 +295,12 @@ func (w *Worker) Filter(tas *task.Task) bool {

### Conformance Tests

If you have nothing else blocking the standard redis port on your machine, then
you can simply run the Redis docker image and execute the conformance tests
labelled with the redis tags.

```
docker run --rm --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
docker run --rm --name redis-stack-rescue -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
```

```
@@ -298,10 +311,14 @@ go test ./... -race -tags redis

### Redis Port

If you have multiple redis instances on your machine you should use a different
port dedicated for the Rescue conformance tests.

```
export REDIS_PORT=6380
docker run --rm --name redis-stack-rescue -p 6380:6379 -p 8002:8001 redis/redis-stack:latest
```

```
docker run --rm --name redis-stack-rescue -p 6380:6379 -p 8002:8001 redis/redis-stack:latest
export REDIS_PORT=6380
go test ./... -race -tags redis
```
16 changes: 2 additions & 14 deletions conformance/delete_cron_redis_test.go
Original file line number Diff line number Diff line change
@@ -12,26 +12,14 @@ import (
"github.com/xh3b4sd/rescue/task"
)

func Test_Engine_Delete_Cron(t *testing.T) {
func Test_Engine_Delete_Cron_Aevery(t *testing.T) {
var err error

var red redigo.Interface
{
red = redigo.Default()
}

{
err = red.Purge()
if err != nil {
t.Fatal(err)
}
}

var eon rescue.Interface
{
eon = engine.New(engine.Config{
Logger: logger.Fake(),
Redigo: red,
Redigo: prgAll(redigo.Default()),
})
}

14 changes: 1 addition & 13 deletions conformance/delete_gate_redis_test.go
Original file line number Diff line number Diff line change
@@ -15,23 +15,11 @@ import (
func Test_Engine_Delete_Gate(t *testing.T) {
var err error

var red redigo.Interface
{
red = redigo.Default()
}

{
err = red.Purge()
if err != nil {
t.Fatal(err)
}
}

var eon rescue.Interface
{
eon = engine.New(engine.Config{
Logger: logger.Fake(),
Redigo: red,
Redigo: prgAll(redigo.Default()),
})
}

16 changes: 2 additions & 14 deletions conformance/delete_node_redis_test.go
Original file line number Diff line number Diff line change
@@ -230,18 +230,6 @@ func Test_Engine_Delete_Gate_Node_All(t *testing.T) {
func Test_Engine_Delete_Node_All_Purge(t *testing.T) {
var err error

var red redigo.Interface
{
red = redigo.Default()
}

{
err = red.Purge()
if err != nil {
t.Fatal(err)
}
}

var tim *timer.Timer
{
tim = timer.New()
@@ -260,7 +248,7 @@ func Test_Engine_Delete_Node_All_Purge(t *testing.T) {
{
eon = engine.New(engine.Config{
Logger: logger.Fake(),
Redigo: red,
Redigo: prgAll(redigo.Default()),
Timer: tim,
Worker: "eon",
})
@@ -270,7 +258,7 @@ func Test_Engine_Delete_Node_All_Purge(t *testing.T) {
{
etw = engine.New(engine.Config{
Logger: logger.Fake(),
Redigo: red,
Redigo: prgAll(redigo.Default()),
Timer: tim,
Worker: "etw",
})
50 changes: 50 additions & 0 deletions conformance/delete_sync_redis_test.go
Original file line number Diff line number Diff line change
@@ -5,23 +5,37 @@ package conformance
import (
"reflect"
"testing"
"time"

"github.com/google/go-cmp/cmp"
"github.com/xh3b4sd/logger"
"github.com/xh3b4sd/redigo"
"github.com/xh3b4sd/rescue"
"github.com/xh3b4sd/rescue/engine"
"github.com/xh3b4sd/rescue/task"
"github.com/xh3b4sd/rescue/timer"
)

func Test_Engine_Delete_Sync(t *testing.T) {
var err error

var tim *timer.Timer
{
tim = timer.New()
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:00Z")
})
}

var eon rescue.Interface
{
eon = engine.New(engine.Config{
Logger: logger.Fake(),
Redigo: prgAll(redigo.Default()),
Timer: tim,
})
}

@@ -39,6 +53,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
}
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:01Z")
})
}

// Create one task with custom sync state.
var tas *task.Task
{
@@ -59,6 +79,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
}
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:02Z")
})
}

// Create another task with paging sync state.
{
tas = &task.Task{
@@ -92,6 +118,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
}
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:03Z")
})
}

{
tas, err = eon.Search()
if err != nil {
@@ -123,6 +155,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
}
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:04Z")
})
}

{
err = eon.Delete(tas)
if err != nil {
@@ -166,6 +204,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
tas.Sync.Set(task.Paging, "233")
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:05Z")
})
}

// Calling Delete on our paging task should expire the task together with the
// synced paging state.
{
@@ -227,6 +271,12 @@ func Test_Engine_Delete_Sync(t *testing.T) {
tas.Sync.Set(task.Paging, "0")
}

{
tim.Setter(func() time.Time {
return musTim("2023-10-20T00:00:06Z")
})
}

{
err = eon.Delete(tas)
if err != nil {
Loading