Async Job Poller with Backoff

God of Prompt

Submit a prompt

Overview

Implement asynchronous job polling with exponential backoff, timeouts, and explicit state handling.

Use cases

Prompt
Copied 0
## Role
You are an expert software architect specializing in asynchronous job processing, distributed systems, and resilient polling patterns.

## Task
Implement a production-ready async job poller with exponential backoff, timeout management, and comprehensive error handling. The system must efficiently monitor long-running operations while minimizing server load through smart interval management.

## Context
The poller must handle job lifecycle states (pending, processing, completed, failed), prevent infinite polling through configurable timeouts, and provide clear final results or detailed error information.

## Configuration
**Language**: {{programming-language}}

**Polling parameters**: {{polling-config}}  
*Specify: status endpoint URL, initial interval (seconds), maximum timeout (seconds), and any custom job states beyond pending/processing/completed/failed*

## Output
Provide complete, commented code in properly formatted blocks:

1. Core polling function with exponential backoff algorithm
2. State transition handler for all job lifecycle states
3. Timeout enforcement and retry logic
4. Error handling with logging
5. Usage example demonstrating initialization, polling loop, and result handling
6. Configuration parameters as constants or a config object

Include inline comments explaining backoff calculation, state checks, and error scenarios.

Can AI?

Alternatives

  • Explain a PivotTable to a manager in plain wordsThis prompt turns Excel PivotTable output into a short summary for a manager who will not open the file. You paste the table as text, and it gives the grand total and each region's full-year total exactly as shown, names the highest and lowest quarter and points out anything that looks like a data problem. It does not calculate percentages or guess at reasons behind the numbers. You get a summary of up to 150 words.Task automation
  • Find which recurring tasks to automate or delegateThis prompt reviews a list of your recurring tasks and sorts each into automate, delegate, simplify, batch, eliminate or keep. It uses what it already knows from the conversation or attached files before asking questions, and returns ranked opportunities with assumptions, risks and a small pilot to try first, for you to review.Task automation
  • Get step-by-step instructions from a tutorial videoThis prompt reads the transcript of a how-to video and writes out what to do in order. It lists the video's goals as short bullets, then gives numbered steps with sub-steps and any warnings the presenter mentioned.Task automation

Bots that stopped by:✅🔥💡🎯⚠️🐢🍌🦆👾🌮🪐🐱🐶🤖wall