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

Release/v0.0.1 alpha.125 #119

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.125](https://github.com/DIG-Network/dig-propagation-server/compare/v0.0.1-alpha.124...v0.0.1-alpha.125) (2024-10-07)

### [0.0.1-alpha.124](https://github.com/DIG-Network/dig-propagation-server/compare/v0.0.1-alpha.123...v0.0.1-alpha.124) (2024-10-07)

### [0.0.1-alpha.123](https://github.com/DIG-Network/dig-propagation-server/compare/v0.0.1-alpha.122...v0.0.1-alpha.123) (2024-10-07)
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dig-propagation-server",
"version": "0.0.1-alpha.124",
"version": "0.0.1-alpha.125",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand All @@ -26,7 +26,7 @@
],
"dependencies": {
"@dignetwork/datalayer-driver": "^0.1.28",
"@dignetwork/dig-sdk": "^0.0.1-alpha.158",
"@dignetwork/dig-sdk": "^0.0.1-alpha.161",
"async-mutex": "^0.5.0",
"busboy": "^1.6.0",
"express": "^4.19.2",
Expand Down
7 changes: 3 additions & 4 deletions src/tasks/sync_stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ const processPeer = async (peerIp: string, storeId: string, rootHash: string, ch
* Clean the checkedPeersMap to retain only the current rootHash.
* @param currentRootHash - The rootHash to retain in the map.
*/
const cleanCheckedPeersMap = (currentRootHash: string): void => {
const cleanCheckedPeersMap = (storeId: string, currentRootHash: string): void => {
for (const [rootHash, _] of checkedPeersMap.entries()) {
if (rootHash !== currentRootHash) {
checkedPeersMap.delete(rootHash);
console.log(`Removed outdated rootHash ${rootHash} from checkedPeersMap.`);
console.log(`Removed outdated rootHash ${storeId}-${rootHash} from checkedPeersMap.`);
}
}
};
Expand All @@ -82,7 +82,7 @@ const handleSyncedStore = async (storeId: string, serverCoin: ServerCoin): Promi
console.log(`Current rootHash for store ${storeId}: ${currentRootHash}`);

// Clean checkedPeersMap to only retain peers checked for the current rootHash
cleanCheckedPeersMap(currentRootHash);
cleanCheckedPeersMap(storeId, currentRootHash);

// Initialize the set for the current rootHash if not present
if (!checkedPeersMap.has(currentRootHash)) {
Expand All @@ -102,7 +102,6 @@ const handleSyncedStore = async (storeId: string, serverCoin: ServerCoin): Promi
return;
}

console.log(`Ranking peers based on latency and bandwidth...`);
const peerRanker = new PeerRanker(peerIps);
const rankedPeers = await peerRanker.rankPeers();

Expand Down
Loading