-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove built in capabilities from local registry on Close #15471
Conversation
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
0199240
to
5042fe0
Compare
5042fe0
to
95178c1
Compare
core/capabilities/compute/compute.go
Outdated
@@ -276,7 +276,7 @@ func (c *Compute) Close() error { | |||
c.modules.close() | |||
close(c.stopCh) | |||
c.wg.Wait() | |||
return nil | |||
return c.registry.Remove(context.TODO(), CapabilityIDCompute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment in the capabilities PR about doing this inside the standard capability job delegate, in one of the hooks.
@@ -57,6 +57,10 @@ func (c *Capability) Start(ctx context.Context) error { | |||
} | |||
|
|||
func (c *Capability) Close() error { | |||
err := c.registry.Remove(context.TODO(), c.capabilityInfo.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Close()
methods, we typically use a sanity check like 1s
so that a service cannot block shutdown or whatever else:
err := c.registry.Remove(context.TODO(), c.capabilityInfo.ID) | |
ctx, cancel := context.WithTimeout(context.Background(), time.Second) | |
defer cancel() | |
err := c.registry.Remove(ctx, c.capabilityInfo.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good tip. Added that!
* Remove built in capabilities from local registry on Close * Add 1 sec timeout to close * Return error instead of logging
Description
Bumps chainlink-common
Introduces a change, where on Capability service closing, it will clean itself up from the local registry.
Affects non-standard capabilities:
Caveats
Blocked by smartcontractkit/chainlink-common#953 which updates common types