-
Notifications
You must be signed in to change notification settings - Fork 953
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
Purge data in explorer based on a parameter #341
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ export class SyncPlatform { | |
syncService: any; | ||
blocksSyncTime: number; | ||
network_config: Record<string, any>; | ||
blockCount: number; | ||
|
||
/** | ||
* Creates an instance of SyncPlatform. | ||
|
@@ -54,6 +55,7 @@ export class SyncPlatform { | |
this.syncService = new SyncServices(this, this.persistence); | ||
this.blocksSyncTime = 60000; | ||
this.network_config = null; | ||
this.blockCount = 1000; | ||
} | ||
|
||
/** | ||
|
@@ -86,6 +88,8 @@ export class SyncPlatform { | |
this.network_name = args[1]; | ||
} | ||
|
||
this.blockCount = network_configs[this.network_id].blockCount; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blockCount needs to be defined in config.json in (app/platform/fabric/config.json) |
||
|
||
logger.info(explorerError.MESSAGE_1002, this.network_id, this.network_name); | ||
|
||
logger.debug('Blocks synch interval time >> %s', this.blocksSyncTime); | ||
|
@@ -119,7 +123,7 @@ export class SyncPlatform { | |
*/ | ||
// During initial sync-up phase, disable discovery request | ||
(function validateMissingBlocks(sync: SyncPlatform, noDiscovery: boolean) { | ||
sync.isChannelEventHubConnected(noDiscovery); | ||
sync.isChannelEventHubConnected(noDiscovery, sync.blockCount); | ||
setTimeout(validateMissingBlocks, sync.blocksSyncTime, sync, false); | ||
})(this, true); | ||
|
||
|
@@ -134,12 +138,19 @@ export class SyncPlatform { | |
* | ||
* @memberof SyncPlatform | ||
*/ | ||
async isChannelEventHubConnected(noDiscovery: boolean) { | ||
async isChannelEventHubConnected(noDiscovery: boolean, blockCount: number) { | ||
for (const channel_name of this.client.getChannels()) { | ||
// Validate channel event is connected | ||
const status = this.eventHub.isChannelEventHubConnected(channel_name); | ||
const status: boolean = this.eventHub.isChannelEventHubConnected( | ||
channel_name | ||
); | ||
if (status) { | ||
await this.syncService.syncBlocks(this.client, channel_name, noDiscovery); | ||
await this.syncService.syncBlocks( | ||
this.client, | ||
channel_name, | ||
noDiscovery, | ||
blockCount | ||
); | ||
} else { | ||
// Channel client is not connected then it will reconnect | ||
this.eventHub.connectChannelEventHub(channel_name); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
"network-configs": { | ||
"test-network": { | ||
"name": "Test Network", | ||
"profile": "./connection-profile/test-network.json" | ||
"profile": "./connection-profile/test-network.json", | ||
"blockCount": "5" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick]: update this to numerical value. |
||
} | ||
}, | ||
"license": "Apache-2.0" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ongoing we can add types also in the function args