Documentation
¶
Overview ¶
Package queueapi provides a client for the queue-api ingest endpoint.
Index ¶
Constants ¶
const DefaultMaxRetries = 4
DefaultMaxRetries is the maximum number of retry attempts for ingest endpoint failures.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the queue-api ingest endpoint.
func NewClient ¶
NewClient creates a new queue-api client.
Parameters:
- baseURL: The base URL of the queue-api (e.g., "http://queue-api:8080")
- authToken: Optional bearer token for authentication (can be empty)
Returns:
- A configured Client ready for use
func (*Client) PostResolution ¶
PostResolution posts a resolution to the ingest endpoint with retry logic.
This method calls the queue-api's /email-resolution/resolve endpoint with the provided email and github username. The source is set to "live" and the resolved_at timestamp is set to the current time.
Retry logic:
- Implements exponential backoff with: 100ms, 400ms, 900ms, 1600ms delays
- Maximum retry attempts: 4 (total max delay: ~3 seconds)
- Retries on transient network errors and timeout errors
- Does not retry on client errors (4xx) except 408 Request Timeout
- Logs all retry attempts with structured error context
The queue claim remains valid during retries since the total retry duration is short (~3 seconds max), which is well within the worker's processing window.
Parameters:
- ctx: Context for the request (cancellation is respected during retries)
- email: The email address to resolve
- githubUsername: The resolved GitHub username
Returns:
- nil on success
- error if all retry attempts are exhausted or a non-retryable error occurs