Skip to content

Conversation

@bokelley
Copy link
Contributor

Problem

AccuWeather syncs were hanging indefinitely on placements discovery, and order operations could hang if GAM API was slow.

Solution

  • Added ThreadPoolExecutor-based timeout decorator
  • Added timeouts to inventory discovery (10min placements, 5min labels, 10min custom targeting)
  • Added partial success handling (sync continues if one type times out)
  • Added timeouts to order operations (60s create, 30s status, 120s fetch, 300s batch)

Impact

  • AccuWeather syncs complete in <30min instead of hanging forever
  • Order creation fails fast (60s) with clear error instead of hanging
  • Operations can be retried when timeouts occur

Testing

  • 846 unit tests passed
  • 174 integration tests passed
  • Ready for production deployment

- Add ThreadPoolExecutor-based timeout decorator
- Add 10min timeout to discover_placements (AccuWeather hangs here)
- Add 5min timeout to discover_labels
- Add 10min timeout to discover_custom_targeting
- Wrap discovery calls in try/except for partial success
- Add 60s timeout to create_order
- Add 30s timeout to get_order_status
- Add 120s timeout to archive_order and get_order_line_items
- Add 300s timeout to create_line_items (batch operations)

Fixes AccuWeather syncs hanging indefinitely on placements discovery.
Prevents order creation from hanging if GAM API is slow.
- cancel_sync.py: Cancel stuck syncs manually
- initialize_tenant_mgmt_api_key.py: Initialize tenant mgmt API key

These tools are useful for production operations and troubleshooting.
- check_accuweather_sync.sh: Full sync diagnostic with API checks
- quick_sync_check.sh: Quick sync status check with timeout

These scripts help diagnose sync issues in production.
@bokelley bokelley merged commit b615290 into main Oct 24, 2025
8 checks passed
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…protocol#587)

* Add timeouts to GAM operations to prevent indefinite hangs

- Add ThreadPoolExecutor-based timeout decorator
- Add 10min timeout to discover_placements (AccuWeather hangs here)
- Add 5min timeout to discover_labels
- Add 10min timeout to discover_custom_targeting
- Wrap discovery calls in try/except for partial success
- Add 60s timeout to create_order
- Add 30s timeout to get_order_status
- Add 120s timeout to archive_order and get_order_line_items
- Add 300s timeout to create_line_items (batch operations)

Fixes AccuWeather syncs hanging indefinitely on placements discovery.
Prevents order creation from hanging if GAM API is slow.

* Add operational scripts for sync management

- cancel_sync.py: Cancel stuck syncs manually
- initialize_tenant_mgmt_api_key.py: Initialize tenant mgmt API key

These tools are useful for production operations and troubleshooting.

* Add diagnostic scripts for sync troubleshooting

- check_accuweather_sync.sh: Full sync diagnostic with API checks
- quick_sync_check.sh: Quick sync status check with timeout

These scripts help diagnose sync issues in production.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants