Skip to content

pkg/capabilities: support replacing registered capabilities after shutdown#1639

Merged
jmank88 merged 1 commit intomainfrom
CRE-1126-cap-job-update
Oct 29, 2025
Merged

pkg/capabilities: support replacing registered capabilities after shutdown#1639
jmank88 merged 1 commit intomainfrom
CRE-1126-cap-job-update

Conversation

@jmank88
Copy link
Copy Markdown
Contributor

@jmank88 jmank88 commented Oct 22, 2025

Comment thread pkg/capabilities/registry/base.go Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 22, 2025

✅ API Diff Results - No breaking changes


📄 View full apidiff report

@jmank88
Copy link
Copy Markdown
Contributor Author

jmank88 commented Oct 22, 2025

Looks like this approach would require updating some generated code

@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 940dec7 to 95c48cb Compare October 22, 2025 21:05
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 95c48cb to 6d0215e Compare October 24, 2025 22:03
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 6d0215e to 2df6298 Compare October 24, 2025 22:04
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 2df6298 to 298c913 Compare October 27, 2025 17:45
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 298c913 to 944e37b Compare October 27, 2025 21:59
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 793d471 to 8913a12 Compare October 28, 2025 23:01
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from 8913a12 to a5bf77b Compare October 28, 2025 23:14
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from a5bf77b to d7dec7a Compare October 28, 2025 23:50
Comment thread pkg/capabilities/registry/base.go Outdated
bc, ok := r.m[id]
if ok {
switch state := bc.GetState(); state {
case connectivity.Shutdown, connectivity.TransientFailure:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Transient is actually fatal in our case, since the plugin cannot be redialed with the same ID.

Comment thread pkg/loop/internal/core/services/oraclefactory/server.go Outdated
return nil, nil, fmt.Errorf("expected StandardCapabilities but got %T", instance)
}
return scs, scs, scs.Reinitialise(ctx)
return scs, scs, nil
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This func is only called once, but we can just move this to the GRPCClient method instead.

Comment on lines +68 to +69
c.CloseAll(c.resources...)
c.resources = nil
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This resource cleanup includes any created oracles

@jmank88 jmank88 requested a review from pavel-raykov October 29, 2025 12:57
@jmank88 jmank88 force-pushed the CRE-1126-cap-job-update branch from ea1c06b to ee68518 Compare October 29, 2025 12:59
Comment on lines +166 to +167
case connectivity.Shutdown, connectivity.TransientFailure, connectivity.Idle:
// allow replace
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to include Idle here, but it is apparently necessary.

if c == nil {
return connectivity.Shutdown
}
if sg, ok := (*c).(StateGetter); ok {
Copy link
Copy Markdown
Contributor

@krehermann krehermann Oct 29, 2025

Choose a reason for hiding this comment

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

why do we need the type cast check here but not on 252, 260?

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.

3 participants