Schedules, Polling, Events and Duplicates
Choose how a workflow starts, count the cost of polling and use a record of handled events so that duplicates do no harm.
In this lesson you will
- Compare schedules, polling and events
- Work out upcoming run dates
- Count empty polls
- Ignore duplicate events safely
About 22 minutes
Two emails about the same order
A customer fills in the shop’s order form once. Ravi’s automation sends the order check email twice. Nothing is broken in the usual sense. The form service, unsure that its message had been received, sent it again, and the workflow dutifully ran twice. This is one of the most common surprises in automation, and it comes from how workflows get started. In this lesson you will look at the three ways a workflow starts, on a schedule, by polling or by an event, and at the habit that protects you from duplicates.
Three ways to start a workflow
- Schedule. A clock starts it, such as every Monday, Wednesday and Friday at nine.
- Polling. The workflow asks a service on a timer, ‘anything new?’, and acts if there is.
- Event. The other service pushes a message to your workflow when something happens. This is often done with a webhook, an address that receives such messages.
Polling is simple but can be wasteful and slow. An event arrives promptly and costs nothing between events, but depends on the sending service behaving. Many people combine them: events for speed and a slower poll that catches anything missed.
The numbers behind the choice
The program below does three things. First it works out the next five runs of a Monday, Wednesday, Friday schedule from Sunday the first of November 2026. Second, it counts how many checks a 15-minute poll makes in a day against a made-up twelve real events. Third, it processes a list of arriving event labels while remembering which ones it has seen.
from datetime import datetime, timedelta
# 1) a schedule: Monday, Wednesday and Friday at 09:00, from Sunday 1 Nov 2026
now = datetime(2026, 11, 1, 9, 30)
runs, day = [], now
while len(runs) < 5:
day += timedelta(days=1)
if day.weekday() in (0, 2, 4):
runs.append(day.replace(hour=9, minute=0))
for r in runs:
print("run:", r.strftime("%a %d %b %H:%M"))
# 2) polling versus events (MADE-UP numbers)
polls_per_day = 24 * 60 // 15
events = 12
print("polls a day at every 15 minutes:", polls_per_day)
print("polls that found nothing:", polls_per_day - events)
# 3) duplicates: the same event can arrive twice
arrivals = ["e1", "e2", "e2", "e3", "e4", "e1", "e5", "e6", "e6"]
seen, done, dupes = set(), [], 0
for e in arrivals:
if e in seen:
dupes += 1
continue
seen.add(e)
done.append(e)
print("arrived:", len(arrivals))
print("processed:", len(done))
print("duplicates ignored:", dupes)
run: Mon 02 Nov 09:00
run: Wed 04 Nov 09:00
run: Fri 06 Nov 09:00
run: Mon 09 Nov 09:00
run: Wed 11 Nov 09:00
polls a day at every 15 minutes: 96
polls that found nothing: 84
arrived: 9
processed: 6
duplicates ignored: 3
The five runs are Mon 02 Nov 09:00, Wed 04 Nov 09:00, Fri 06 Nov 09:00, Mon 09 Nov 09:00, Wed 11 Nov 09:00, and they skip the weekend as expected. A 15-minute poll makes 96 checks a day, and with only twelve real events, 84 of them found nothing. That is not a problem in itself, but it shows why a very short poll interval is costly, and why many services limit how often you may ask. The last block shows duplicates. 9 events arrived, but some labels appeared twice. The workflow processed 6 and ignored 3, because it kept a set of the labels it had already seen.
Idempotency: doing it twice does no harm
The habit that protects you is called idempotency, a long word for a simple idea: running the same step twice should give the same result as running it once. The usual method is to keep a record of event identifiers you have handled. When an event arrives, check the record first. If it is there, stop quietly. If not, do the work and add the identifier. Events can also arrive late or out of order, and services often retry when they do not get a reply in time, so duplicates are normal, not rare. Treat them as expected.
Many platforms offer a built-in way to deduplicate, or a place to store a value between runs. If yours does not, a simple sheet with one column of identifiers and a lookup step does the job.
Choosing a start for your workflow
- Use a schedule when the work is regular and nobody is waiting, such as a weekly report.
- Use an event when a person or customer is waiting for a fast response.
- Poll when the service offers no events, and choose the longest interval you can live with.
- For anything important, add the duplicate check and a periodic catch-up.
Assuming each event arrives exactly once. Retries and network hiccups mean the same message can arrive twice, and without a check your customer gets two emails or two invoices.
The dates, poll counts and event labels are made up for teaching. Which start types you have, and how often you may poll, depends on your tool, plan and the services you connect, so check their current documentation.
Practice for this lesson
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
What is polling?
- Receiving a pushed message
- Asking a service on a timer whether anything is new
- Deleting old data
- Running only on Mondays
The workflow asks; the service does not push.
What is a webhook?
- A type of spreadsheet
- A password manager
- A schedule
- An address that receives messages sent when something happens
It lets a service push events to your workflow.
Why did the event program ignore three arrivals?
- They were empty
- They repeated labels it had already seen
- They arrived late at night
- They were too long
It kept a set of handled labels.
What does idempotency mean?
- Running a step faster
- Running a step in secret
- Never running a step
- Running a step twice gives the same result as once
A repeat does no extra harm.
When is a schedule a good start?
- For regular work where nobody is waiting
- For urgent customer replies
- For one-off events
- Never
A weekly report is a typical example.
Summary
- Workflows start by schedule, by polling or by event.
- Short poll intervals mean many empty checks.
- Duplicates and late events are normal.
- Keep a record of handled identifiers so a repeat does no harm.
Questions
Are webhooks better than polling?
Often faster and cheaper, but they depend on the sending service. Many setups use events plus an occasional poll as a safety net.
Where do I store handled event identifiers?
A sheet, a database table or a stored value in your platform. Check what your tool offers.
Are those dates and counts real?
The dates are real calendar dates for 2026, but the poll and event counts are made-up numbers.
