@@ -7,15 +7,14 @@ import (
77 "sync"
88 "time"
99
10- "github.com/go-redsync/redsync/v4"
11- redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo"
12- "github.com/gomodule/redigo/redis"
13-
1410 "github.com/RichardKnop/machinery/v1/backends/iface"
1511 "github.com/RichardKnop/machinery/v1/common"
1612 "github.com/RichardKnop/machinery/v1/config"
1713 "github.com/RichardKnop/machinery/v1/log"
1814 "github.com/RichardKnop/machinery/v1/tasks"
15+ "github.com/go-redsync/redsync/v4"
16+ redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo"
17+ "github.com/gomodule/redigo/redis"
1918)
2019
2120// Backend represents a Redis result backend
@@ -158,6 +157,10 @@ func (b *Backend) mergeNewTaskState(conn redis.Conn, newState *tasks.TaskState)
158157
159158// SetStatePending updates task state to PENDING
160159func (b * Backend ) SetStatePending (signature * tasks.Signature ) error {
160+ if signature .NoBackend {
161+ return nil
162+ }
163+
161164 conn := b .open ()
162165 defer conn .Close ()
163166
@@ -167,6 +170,10 @@ func (b *Backend) SetStatePending(signature *tasks.Signature) error {
167170
168171// SetStateReceived updates task state to RECEIVED
169172func (b * Backend ) SetStateReceived (signature * tasks.Signature ) error {
173+ if signature .NoBackend {
174+ return nil
175+ }
176+
170177 conn := b .open ()
171178 defer conn .Close ()
172179
@@ -177,6 +184,10 @@ func (b *Backend) SetStateReceived(signature *tasks.Signature) error {
177184
178185// SetStateStarted updates task state to STARTED
179186func (b * Backend ) SetStateStarted (signature * tasks.Signature ) error {
187+ if signature .NoBackend {
188+ return nil
189+ }
190+
180191 conn := b .open ()
181192 defer conn .Close ()
182193
@@ -187,6 +198,10 @@ func (b *Backend) SetStateStarted(signature *tasks.Signature) error {
187198
188199// SetStateRetry updates task state to RETRY
189200func (b * Backend ) SetStateRetry (signature * tasks.Signature ) error {
201+ if signature .NoBackend {
202+ return nil
203+ }
204+
190205 conn := b .open ()
191206 defer conn .Close ()
192207
@@ -197,6 +212,10 @@ func (b *Backend) SetStateRetry(signature *tasks.Signature) error {
197212
198213// SetStateSuccess updates task state to SUCCESS
199214func (b * Backend ) SetStateSuccess (signature * tasks.Signature , results []* tasks.TaskResult ) error {
215+ if signature .NoBackend {
216+ return nil
217+ }
218+
200219 conn := b .open ()
201220 defer conn .Close ()
202221
@@ -207,6 +226,10 @@ func (b *Backend) SetStateSuccess(signature *tasks.Signature, results []*tasks.T
207226
208227// SetStateFailure updates task state to FAILURE
209228func (b * Backend ) SetStateFailure (signature * tasks.Signature , err string ) error {
229+ if signature .NoBackend {
230+ return nil
231+ }
232+
210233 conn := b .open ()
211234 defer conn .Close ()
212235
0 commit comments