Skip to content

Conversation

@cipheraxat
Copy link

Summary

Adds a convenience method to poll for knowledge base indexing job completion, eliminating the need for manual polling loops.

Changes

  • Add waitForCompletion method to IndexingJobs class
  • Configurable polling interval (default: 2000ms) and timeout (default: 10 minutes)
  • Proper error handling for failed, cancelled, and error states
  • Comprehensive test coverage for all scenarios
  • Usage example demonstrating the new API

API

async waitForCompletion(
  uuid: string, 
  opts?: { interval?: number; timeout?: number }
): Promise<IndexingJobRetrieveResponse>

- Add waitForCompletion method to IndexingJobs class that polls job status
- Configurable polling interval (default 2s) and timeout (default 10min)
- Resolves when job succeeds, rejects on failure/error/cancellation/timeout
- Includes comprehensive tests covering success, failure, and timeout scenarios
- Add usage example demonstrating the new helper vs manual polling

Fixes digitalocean#6
@bbatha
Copy link
Collaborator

bbatha commented Oct 22, 2025

Closing as a dupe of #14

@bbatha bbatha closed this Oct 22, 2025
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