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

Fix reindexing token pool created events when creation and active are different steps #1599

Closed
wants to merge 8 commits into from
2 changes: 1 addition & 1 deletion internal/assets/token_pool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 Kaleido, Inc.
// Copyright © 2024 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down
7 changes: 6 additions & 1 deletion internal/definitions/handler_tokenpool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 Kaleido, Inc.
// Copyright © 2024 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -92,6 +92,11 @@
}
}

if existing.ID.Equals(pool.ID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand how we got to this point with a duplicate ID. Your description indicates we are processing a TokenPoolCreated event, so we're coming in via eventManager.TokenPoolCreated() and then definitionSender.DefineTokenPool() and then here.

But in eventManager.TokenPoolCreated(), there is a check for an existing pool. Is that check failing to find the existing pool and allowing it to get down to here?

Copy link
Contributor

@awrichar awrichar Nov 21, 2024

Choose a reason for hiding this comment

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

Also worth confirming... were you running the latest release (v1.3.2) when you saw this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, running the latest v1.3.2 release

log.L(ctx).Warnf("Received duplicate token pool creation with ID=%s, ignoring and carrying on for token connector: %s", pool.ID, pool.Connector)
break

Check warning on line 97 in internal/definitions/handler_tokenpool.go

View check run for this annotation

Codecov / codecov/patch

internal/definitions/handler_tokenpool.go#L96-L97

Added lines #L96 - L97 were not covered by tests
}

// Any other conflict - reject
return HandlerResult{Action: core.ActionReject, CustomCorrelator: correlator}, i18n.NewError(ctx, coremsgs.MsgDefRejectedConflict, "token pool", pool.ID, existing.ID)
}
Expand Down
Loading