-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use separate eventstream per namespace #135
Conversation
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
@@ -15,7 +15,7 @@ | |||
// limitations under the License. | |||
|
|||
import { BadRequestException, Injectable, Logger } from '@nestjs/common'; | |||
import * as LRUCache from 'lru-cache'; | |||
import LRUCache from 'lru-cache'; |
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.
Definitely make sure the Docker still works with this. We've seen weird differences in Node depending on the default import syntax.
@@ -1,5 +1,5 @@ | |||
PORT=3000 | |||
ETHCONNECT_URL=http://127.0.0.1:5102 | |||
ETHCONNECT_INSTANCE=/contracts/erc1155 |
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.
Wow, this one is old. Why did it pop back up? Do we still rely on it anywhere? Definitely tried to move to CONTRACT_ADDRESS
a while back.
src/tokens/tokens.service.ts
Outdated
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// http://www.apache.org/licenses/LICENSE -2.0 |
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.
?
src/tokens/tokens.service.ts
Outdated
await this.createPoolSubscription(ctx, defaultContract, BASE_SUBSCRIPTION_NAME); | ||
} | ||
} | ||
async onConnect() {} |
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.
I think this can be removed, along with the supporting methods that wanted it to exist...
this.logger.log('Using event stream with name ' + name); | ||
this.stream = await this.eventstream.createOrUpdateStream(ctx, name, name); | ||
return this.stream; | ||
await this.migrationCheck(ctx); |
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.
As in ERC20, I think this should be removed.
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.
Actually... looks like you have already repurposed it in this case to do the purge instead of just the check. That's probably fine.
this.currentClient = undefined; | ||
// Iterate over all the namespaces this client was subscribed to | ||
this.namespaceClients.forEach((clientSet, namespace) => { | ||
clientSet.delete(client); |
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.
Same note as ERC20 - shouldn't we check the return to see if the clientSet actually included this client?
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.
I think now that awaitingAck
is scoped to the client itself, none of the rest of this loop will have any effect if the client wasn't listening on the namespace
@@ -186,6 +195,7 @@ export class TokenListener implements EventListener { | |||
interfaceFormat: InterfaceFormat.ABI, | |||
poolData: unpackedSub.poolData, | |||
poolLocator: packedPoolLocator, | |||
alternateLocators: oldLocator ? [oldLocator] : [], |
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.
Glad this turned out to be a (relatively) simple migration path.
@@ -50,6 +50,18 @@ export interface WebSocketMessage { | |||
data: any; |
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.
Can delete this type if it's unused.
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.
Looks good - basically all the same feedback as hyperledger/firefly-tokens-erc20-erc721#140. Thanks for figuring out the weirdness with the pool locator migration on this one too.
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Parallel to hyperledger/firefly-tokens-erc20-erc721#140