Skip to content
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

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

justinkaseman
Copy link
Contributor

@justinkaseman justinkaseman commented Dec 2, 2024

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:

  • WebAPI Trigger
  • WebAPI Target
  • Compute
  • ChainWriter

Caveats

Blocked by smartcontractkit/chainlink-common#953 which updates common types

Copy link
Contributor

github-actions bot commented Dec 2, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@justinkaseman justinkaseman force-pushed the CAPPL-235 branch 5 times, most recently from 0199240 to 5042fe0 Compare December 5, 2024 06:28
@justinkaseman justinkaseman marked this pull request as ready for review December 5, 2024 06:54
@justinkaseman justinkaseman requested review from a team as code owners December 5, 2024 06:54
@@ -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)
Copy link
Contributor

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)
Copy link
Contributor

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:

Suggested change
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)

Copy link
Contributor Author

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!

@justinkaseman justinkaseman added this pull request to the merge queue Dec 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 5, 2024
@justinkaseman justinkaseman added this pull request to the merge queue Dec 5, 2024
Merged via the queue into develop with commit ef3fd2f Dec 5, 2024
166 of 167 checks passed
@justinkaseman justinkaseman deleted the CAPPL-235 branch December 5, 2024 19:26
jhweintraub pushed a commit that referenced this pull request Dec 6, 2024
* Remove built in capabilities from local registry on Close

* Add 1 sec timeout to close

* Return error instead of logging
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.

5 participants