# AsyncReceive to prevent signal loss

**URL:** <https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732>\
**Category:** Developer Corner\
**Created:** [March 11, 2025, 4:27am UTC](https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732 "2025-03-11T04:27:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zac\_Wu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/zac_wu/32/6965_2.png) [@Zac\_Wu](https://community.temporal.io/u/Zac_Wu)\
**Post date:** [March 11, 2025, 4:27am UTC](https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732/1 "2025-03-11T04:27:53Z")

</div>

Hi,  
I am reading the [sliding window example](https://github.com/temporalio/samples-go/tree/main/batch-sliding-window) of Temporal golang samples. I get it that a reportCompletionChannel.ReceiveAsync is called in a for loop until no more message is available. Then the workflow will proceed to continue-as-new.  
My question is what happen if new signals arrived during the gap between the for loop is exit and the continue-as-new is executed?  
Will signals get buffered? If signal is buffered, what is the point of calling ReceiveSync?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 11, 2025, 6:04pm UTC](https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732/2 "2025-03-11T18:04:04Z")

</div>

> My question is what happen if new signals arrived during the gap between the for loop is exit and the continue-as-new is executed?

The workflow code is rolled back to the location of the last goroutine blockage and reexecuted, so the new signal will be processed.

---

<div class="post-metadata">

**Author:** ![Zac\_Wu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/zac_wu/32/6965_2.png) [@Zac\_Wu](https://community.temporal.io/u/Zac_Wu)\
**Post date:** [March 11, 2025, 11:38pm UTC](https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732/3 "2025-03-11T23:38:19Z")

</div>

thanks, if there is a roll back mechanism like this, then why do we still need to call ReceiveSync?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [March 12, 2025, 4:53pm UTC](https://community.temporal.io/t/asyncreceive-to-prevent-signal-loss/16732/4 "2025-03-12T16:53:51Z")

</div>

Because it rolls back a single workflow task and blocking a workflow creates another one.
