# Interesting Infrequent Polling Use Case!

**URL:** <https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311>\
**Category:** Community Support\
**Created:** [September 9, 2025, 6:44pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311 "2025-09-09T18:44:15Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 9, 2025, 6:44pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/1 "2025-09-09T18:44:15Z")

</div>

Hello! I have an interesting infrequent polling use case (~once an hour) that I’d like your advise on.

I’ll preface this with saying that I’ve read some other community [threads](https://community.temporal.io/t/long-polling-inside-workflows-or-activities/11348/8) and the recommended approach on [infrequent polling implementation](https://github.com/temporalio/samples-typescript/tree/main/polling/infrequent) in the Typescript samples repository. That being said, I’m not sure the strategy of “implement polling within an activity, and let that activity fail benignly, retry, etc.” fits my use case. I could be wrong though.

So: our use case.

1. We have a timer that waits X amount of time. If the time passes before an `isCondition` is true, we want to execute some business logic (a reminder) and continue waiting for `isCondition` to become true.

2. `isCondition` can become true in two different ways:

- Listening to a signal from a client, receiving that signal with an update handler, and, along with some other business logic, setting `isCondition` to true. This is implemented without any issue.

- Polling an external service to see if a condition is true. If the results from this polling action returns true, we also want to set `isCondition` to true. This is where I’m not sure what the best pattern is to implement this business logic. Currently, I have:

Would this work? Am I missing anything about why this wouldn’t work? Is this a huge anti pattern, and can anyone think of a better way to implement this business logic, as I know this isn’t the recommended infrequent polling architecture discussed in other threads

Thanks in advance! @antonio.perez @maxim

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 9, 2025, 11:59pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/2 "2025-09-09T23:59:01Z")

</div>

Just had another idea from a colleague:

The original (simpler) conditional logic without the polling looked like this:  
` await condition(() => isConditionTrueVariable, timeUntilReminder)`

To integrate the polling logic into this control flow, could you just do this?

```auto
await condition(() => { 
   const pollingResult = await myPollingActivity()
   return pollingResult || isConditionTrueVariable
}, timeUntilReminder)

```

Where “myPollingActivity” is implemented as suggested in the infrequent polling sample repository?

My biggest concern with the above is not really understanding how/when that T/F callback is invoked, and whether or not calling a polling activity WITHIN that callback is going to work as intended + expected.

---

<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:** [September 10, 2025, 4:36am UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/3 "2025-09-10T04:36:26Z")

</div>

Failing activity with a benign exception is the most scalable approach for infrequent polls.

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 10, 2025, 5:30am UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/4 "2025-09-10T05:30:20Z")

</div>

That makes sense, and I’d prefer to set up infrequent polls with an activity!

However, would the code in my follow up comment work? Would I get the behavior I’m expecting if I await for my polling activity **within** the true/false condition callback?

---

<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:** [September 10, 2025, 3:50pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/5 "2025-09-10T15:50:56Z")

</div>

I think the blocking condition is not a good pattern. I would await the tasks from the condition and the polling activities separately.

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 10, 2025, 5:45pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/6 "2025-09-10T17:45:24Z")

</div>

Hmm I see what you mean. But if I await the polling activities separately, doesn’t that mean I wouldn’t be able to use the result from the polling activity to interrupt/stop the `condition` call? I’d like the result of the polling activity to “short-circuit” the `condition` call before the “timeUntilReminder” is hit.

---

<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:** [September 10, 2025, 11:02pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/7 "2025-09-10T23:02:09Z")

</div>

You can update a variable that the condition waits on when the activity completes.

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 11, 2025, 2:33am UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/8 "2025-09-11T02:33:03Z")

</div>

Ohhh I see!

But for the polling variable that the condition will check and wait for, you let that run in the background?

So something like this?

```auto
isPollingResponseTrue = pollingActivityHere()

await condition(() => isPollingResponseTrue || isOtherConditionVariableTrue, timeUntilReminder)

```

---

<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:** [September 11, 2025, 5:29pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/9 "2025-09-11T17:29:26Z")

</div>

Yes, assuming that

```
isPollingResponseTrue = pollingActivityHere()

```

runs in parallel to the condition

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 11, 2025, 6:34pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/10 "2025-09-11T18:34:14Z")

</div>

That makes sense, thanks so much!

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 15, 2025, 5:58pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/11 "2025-09-15T17:58:18Z")

</div>

> [@maxim](#):
>
> le that the condition waits on when the activity

Hi Maxim, follow up question. Ran into some issues when actually implementing this. As you can see in the screen shots below, leaving the call to the polling activity like `isPollingResponseTrue = pollingActivityHere()` (trying to get it to run in the background, parallel to the `await condition` call) causes the following typing issues:

 ![Screenshot 2025-09-15 at 10.53.34 AM](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/c/c341f0e879b8aa5ccb4c75d3f066f744ca1699a5.png)

 ![Screenshot 2025-09-15 at 10.53.41 AM](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/0/0542a0ca644468f37e246031236a288e9611178d.png)

I included some context to give you an idea of what the business logic I’m trying to implement.

Obviously, these typing issues could be resolved by changing the call to the polling activity to `const isBillPlatformInvoiceStatusPaid = await pollInvoicePaymentStatus(billPlatformInvoiceId, `_`invoiceNumber`_`)`, but at that point, I don’t think the call to the polling activity runs in parallel to the condition? Unless, when the polling activity fails with a benign application failure, it still allows for the Temporal workflow to check the condition?

Thoughts?

---

<div class="post-metadata">

**Author:** ![Ryan\_Arifin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ryan_arifin/32/6784_2.png) [@Ryan\_Arifin](https://community.temporal.io/u/Ryan_Arifin)\
**Post date:** [September 15, 2025, 8:27pm UTC](https://community.temporal.io/t/interesting-infrequent-polling-use-case/18311/12 "2025-09-15T20:27:03Z")

</div>

Interestingly, awaiting for the polling activity seemed to work (at least in a Temporal time skipping testing environment)! I was running into OOM errors (deployed on Render) when trying to implement it with the background thread method.
