Skip to content

Commit

Permalink
Merge pull request #119 from DIG-Network/release/v0.0.1-alpha.125
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.125
  • Loading branch information
MichaelTaylor3D authored Oct 7, 2024
2 parents 4fa03e8 + 1e56d26 commit 5af8346
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
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

0 comments on commit 5af8346

Please sign in to comment.