Skip to content

fix: Add custom retry delay support for startVM API calls#156

Merged
christianalfoni merged 3 commits into
mainfrom
custom-retry-delay
Aug 13, 2025
Merged

fix: Add custom retry delay support for startVM API calls#156
christianalfoni merged 3 commits into
mainfrom
custom-retry-delay

Conversation

@christianalfoni
Copy link
Copy Markdown
Contributor

  • Added retryDelay parameter to startVm method with default 200ms
  • Sandbox creation: uses 200ms delay (preserves existing behavior)
  • Sandbox restart: uses 1000ms delay for better stability
  • Sandbox resume: uses 500ms delay for hibernated sandboxes
  • Connection fallbacks: use 200ms delay for reconnection scenarios

- Added retryDelay parameter to startVm method with default 200ms
- Sandbox creation: uses 200ms delay (preserves existing behavior)
- Sandbox restart: uses 1000ms delay for better stability
- Sandbox resume: uses 500ms delay for hibernated sandboxes
- Connection fallbacks: use 200ms delay for reconnection scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Aug 13, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Comment thread src/API.ts Outdated
}

async startVm(id: string, data?: VmStartData["body"]) {
async startVm(id: string, data?: VmStartData["body"], retryDelay: number = 200) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With an optional optional parameter, I would rather introduce an options parameter. That way we don't pass undefined for data to most cases. Also clarifies intent when calling the function.

interface StartVmOptions {
  data?: VmStartData['body'];
  /**
   * Milliseconds to wait before each retry.
   * Defaults to 200 ms if omitted.
   */
  retryDelay?: number;
}

startVm(id: string, options: StartVmOptions) {
  const {
    data,
    retryDelay = 200
  } = options

  // etc.
}

Copy link
Copy Markdown
Contributor

@tristandubbeld tristandubbeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christianalfoni christianalfoni merged commit ce3a282 into main Aug 13, 2025
1 check passed
mohamedveron pushed a commit that referenced this pull request Nov 20, 2025
* Add custom retry delay support for startVM API calls

- Added retryDelay parameter to startVm method with default 200ms
- Sandbox creation: uses 200ms delay (preserves existing behavior)
- Sandbox restart: uses 1000ms delay for better stability
- Sandbox resume: uses 500ms delay for hibernated sandboxes
- Connection fallbacks: use 200ms delay for reconnection scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* add explicit retry in build

* use merged options object instead

---------

Co-authored-by: Claude <noreply@anthropic.com>
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