Sub topic 13
Update Frequency and Data Freshness
Assume you understand SKUs, product feeds, and basic XML or JSON. This chapter focuses on keeping product information current after the initial submission. A valid feed can still produce poor shopping results if its price, stock status, or delivery details are stale.
Why freshness matters
Data freshness is the time between a change in your store and the time that every published data source reflects that change. The important sources usually include:
- Your commerce platform, which is the source of truth.
- A product feed sent to a merchant account.
- Structured data on the product page.
- The visible price, stock status, and delivery information on that page.
Shopping systems compare these sources. If the feed says a product is in stock but the page says it is unavailable, the system may distrust the item, delay updates, or reject it. A stale price can cause a mismatch even when the product title and identifiers are correct.
Choose schedules by change risk
Do not use one refresh schedule for every attribute. Match the schedule to how quickly an error can harm a customer.
| Data type | Examples | Suitable update approach |
|---|---|---|
| Fast-changing | Inventory, price, sale price | Event-driven updates or several times daily |
| Medium-changing | Shipping cost, delivery estimate | Daily, or whenever carrier rules change |
| Slow-changing | Description, dimensions, materials | Daily or after catalog edits |
| Policy-sensitive | Returns, availability dates | Immediately after a policy change |
An event-driven update runs when an order, stock adjustment, or price change occurs. A scheduled update runs at fixed times. Many stores use both: events handle urgent changes, while a full daily export catches missed events and repairs drift.
Model the update pipeline
A useful pipeline records when each product was changed, exported, fetched, and accepted. These timestamps help distinguish a store problem from a transport or processing delay.
Track at least these values:
catalog_updated_at: when the source record changed.feed_generated_at: when an export included the change.feed_fetched_at: when the destination retrieved the file.processed_at: when the destination accepted the item.
The difference between these timestamps is operational latency. A product may be fresh in your database but stale in a cached feed URL.
Detect stale records
Define a freshness objective for each important field. For example, inventory may need to reach the feed within 15 minutes, while descriptions may have a 24-hour target. Alert when the age exceeds that target.
from datetime import datetime, timedelta, timezone
records = [
{"id": "SKU-1001", "updated_at": "2026-11-29T10:20:00+00:00"},
{"id": "SKU-1002", "updated_at": "2026-11-29T08:00:00+00:00"},
]
now = datetime(2026, 11, 29, 10, 40, tzinfo=timezone.utc)
maximum_age = timedelta(minutes=30)
for record in records:
updated = datetime.fromisoformat(record["updated_at"])
age = now - updated
if age > maximum_age:
print(f"{record['id']}: stale by {age - maximum_age}")This check measures source freshness. Add separate checks for feed retrieval and landing-page freshness, because one stage can fail while the others continue working.
Set a recovery plan
When a feed fails, retry with backoff and keep the last known good file available. Do not replace a working feed with an empty or partially generated export. For urgent price or stock changes, prioritize a small incremental update if the submission system supports it. After recovery, run a full export to remove drift.
Exercise
A product changed from instock to outofstock, but the merchant account still shows instock six hours later. Which timestamps should you inspect first?
Show answer
Compare catalogupdatedat, feedgeneratedat, feedfetchedat, and processed_at. The first gap that exceeds the freshness target identifies the failing stage.