feat: support durable task cancellation without foreign keys
This commit is contained in:
@@ -51,6 +51,7 @@ type workerFaultGateway struct {
|
||||
drop atomic.Value
|
||||
target atomic.Value
|
||||
dropOffline atomic.Bool
|
||||
dropCancel atomic.Bool
|
||||
offline atomic.Bool
|
||||
mu sync.Mutex
|
||||
active map[*websocket.Conn]struct{}
|
||||
@@ -137,6 +138,10 @@ func newWorkerFaultGateway(t *testing.T, upstream string) *workerFaultGateway {
|
||||
operation := operations[f.ReplyTo]
|
||||
delete(operations, f.ReplyTo)
|
||||
mu.Unlock()
|
||||
if f.Type == "task.cancel" && g.dropCancel.CompareAndSwap(true, false) {
|
||||
g.dropped <- "task.cancel"
|
||||
return
|
||||
}
|
||||
if f.Type == "ack" && operation != "" && g.drop.CompareAndSwap(operation, "") {
|
||||
if g.dropOffline.Load() {
|
||||
g.offline.Store(true)
|
||||
|
||||
Reference in New Issue
Block a user