Skip to content

Conversation

@yaninyzwitty
Copy link
Contributor

  • Introduced isHealthyBuilder helper to centralize status checks
  • Added context cancellation for Cluster.startSync to prevent goroutine leaks
  • Preallocate slice when converting cluster instances map to improve performance
  • Replaced fmt.Sprintf with string concatenation for endpoint URLs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 123 to 124
if !isHealthyBuilder(instance) {
return nil, ErrTemplateBuilderNotFound

Choose a reason for hiding this comment

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

P2 Badge Allow draining builders for node-specific lookups

GetTemplateBuilderByNodeID now rejects any builder that is not strictly Healthy, which excludes the Draining state. However draining is still treated as healthy for service traffic (see packages/client-proxy/internal/edge/handlers/healthy.go), and node-specific operations rely on this lookup (e.g. temporary build logs in template-manager/logs.go, and build client selection in template_manager.go). When a node enters draining during shutdown, these paths will now fail or fall back to another node even though the draining builder is still serving in-flight builds, causing missing logs or failed build operations for those builds.

Useful? React with 👍 / 👎.

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

Please remove the part with cancel as it isn't really needed

Comment on lines 105 to 107
if c.cancel != nil {
c.cancel() // stop startSync goroutine
}
Copy link
Member

Choose a reason for hiding this comment

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

The startSync goroutine is stopped by calling

	c.synchronization.Close()

if instance.GetStatus() == infogrpc.ServiceInfoStatus_Unhealthy || !instance.IsBuilder() {
return nil, ErrTemplateBuilderNotFound
}

Copy link
Member

Choose a reason for hiding this comment

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

Please return the deleted newlines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

Return newlines

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

Last small NIT

@jakubno jakubno merged commit 48bab49 into e2b-dev:main Jan 3, 2026
22 checks passed
@jakubno
Copy link
Member

jakubno commented Jan 3, 2026

Thanks, @yaninyzwitty, for your contribution!

@yaninyzwitty yaninyzwitty deleted the improvement/cluster-instance-slice-clean branch January 3, 2026 13:07
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