# Cancel a workflow queued job/signal in a sequential workflow signal loop

**URL:** <https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [April 7, 2022, 9:56am UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382 "2022-04-07T09:56:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisFindon](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chrisfindon/32/726_2.png) [@ChrisFindon](https://community.temporal.io/u/ChrisFindon)\
**Post date:** [April 7, 2022, 9:56am UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382/1 "2022-04-07T09:56:03Z")

</div>

using the following sequential by id otherwise parallel strategy below, how would I go about canceling a job in a sequential queue?  
either the current being worked on workflow job or another job waiting in the queue

I thought about another signal but that would only work on the currently running job, is there a way to request a signal waiting to be processed to be canceled?

below strategy discussed in the following topic: [Go SDK - Sequential by ID otherwise in parallel - #5 by maxim](https://community.temporal.io/t/go-sdk-sequential-by-id-otherwise-in-parallel/1486/5)

```
signalChan := workflow.GetSignalChannel(ctx, signalName)

for i := 0; i < CONTINUE_AS_NEW_FREQUENCY; i++ {
	var signalVal string
	signalChan.Receive(ctx, &signalVal)
	workflow.GetLogger(ctx).Info("Received signal!", "signal", signalName, "value", signalVal)
	// PROCESS SIGNAL
}
// Drain signal channel asynchronously to avoid signal loss
for {
	var signalVal string
	ok := signalChan.ReceiveAsync(&signalVal)
	if !ok {
		break;
	}
	workflow.GetLogger(ctx).Info("Received signal!", "signal", signalName, "value", signalVal)
	// PROCESS SIGNAL
}
return workflow.NewContinueAsNewError(ctx, WorkflowFn)
```

---

<div class="post-metadata">

**Author:** ![Chad\_Retz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chad_retz/32/1396_2.png) [@Chad\_Retz](https://community.temporal.io/u/Chad_Retz)\
**Post date:** [April 7, 2022, 1:14pm UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382/2 "2022-04-07T13:14:24Z")

</div>

> [@ChrisFindon](#):
>
> how would I go about canceling a job in a sequential queue?

Can you clarify what you mean by job here and what you’re trying to do?

> [@ChrisFindon](#):
>
> is there a way to request a signal waiting to be processed to be canceled?

Completing a workflow will essentially ignore remaining signals. You can choose to process signals or not. The example you are showing only has value in the advanced use case of continue-as-new. If you need to just complete a workflow, you don’t need to drain channels.

---

<div class="post-metadata">

**Author:** ![ChrisFindon](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chrisfindon/32/726_2.png) [@ChrisFindon](https://community.temporal.io/u/ChrisFindon)\
**Post date:** [April 7, 2022, 9:46pm UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382/3 "2022-04-07T21:46:28Z")

</div>

job, in this case, is the next signal, another iteration of the workflow essentially runs the workflow again with different input.

for each workflow id if they are the same they are queued by signals if I wanted to cancel one of these signals in a queue is there a way to do this?

---

<div class="post-metadata">

**Author:** ![Chad\_Retz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chad_retz/32/1396_2.png) [@Chad\_Retz](https://community.temporal.io/u/Chad_Retz)\
**Post date:** [April 8, 2022, 1:11pm UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382/4 "2022-04-08T13:11:18Z")

</div>

There isn’t really a concept of “cancel” signal. You can definitely ignore signals in code if you don’t want to process them (which essentially what happens to the rest of the signals when you return from the workflow).

---

<div class="post-metadata">

**Author:** ![ChrisFindon](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chrisfindon/32/726_2.png) [@ChrisFindon](https://community.temporal.io/u/ChrisFindon)\
**Post date:** [April 9, 2022, 4:18am UTC](https://community.temporal.io/t/cancel-a-workflow-queued-job-signal-in-a-sequential-workflow-signal-loop/4382/5 "2022-04-09T04:18:49Z")

</div>

OK, that is what I thought might be the case, was hoping there was a way to terminate one of the signals. I will add a check, as a part of each activity to check if the job has been canceled, (goal is also to be able to cancel a job that is stuck in a retry loop, or prevent the job to be run at all)

Thanks for your assistance Chad.
