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.131 #125

Merged
merged 3 commits into from
Oct 8, 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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.131](https://github.com/DIG-Network/dig-propagation-server/compare/v0.0.1-alpha.130...v0.0.1-alpha.131) (2024-10-08)


### Bug Fixes

* check if store has roothash ([b277263](https://github.com/DIG-Network/dig-propagation-server/commit/b2772639f6159a9b13389f66d890ce2895fdbb31))
* check if store has roothash ([f920566](https://github.com/DIG-Network/dig-propagation-server/commit/f920566ddf2c2ea5d898fdfda5be05836b4abef7))

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

### [0.0.1-alpha.129](https://github.com/DIG-Network/dig-propagation-server/compare/v0.0.1-alpha.128...v0.0.1-alpha.129) (2024-10-07)
Expand Down
12 changes: 6 additions & 6 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.130",
"version": "0.0.1-alpha.131",
"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.165",
"@dignetwork/dig-sdk": "^0.0.1-alpha.167",
"async-mutex": "^0.5.0",
"busboy": "^1.6.0",
"express": "^4.19.2",
Expand Down
11 changes: 8 additions & 3 deletions src/tasks/sync_stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@ const checkedPeersMap: Map<string, Set<string>> = new Map();
const processPeer = async (peerIp: string, storeId: string, rootHash: string, checkedPeers: Set<string>): Promise<void> => {
try {
const digPeer = new DigPeer(peerIp, storeId);
const hasRootHash = await withTimeout(digPeer.contentServer.hasRootHash(rootHash), 15000, `Dig Peer: ${peerIp} took to long to respond to head request`);
const { storeExists, rootHashExists } = await withTimeout(digPeer.propagationServer.checkStoreExists(rootHash), 15000, `Dig Peer: ${peerIp} took to long to respond to head request`);

if (hasRootHash) {
if (!storeExists) {
console.log(`Dig Peer ${peerIp} does not have store ${storeId}. Skipping...`);
return;
}

if (rootHashExists) {
console.log(`Dig Peer ${peerIp} already has rootHash ${rootHash}. Marking as checked.`);
checkedPeers.add(peerIp); // Mark as checked only if peer has the rootHash
} else {
console.log(`Dig Peer ${peerIp} does not have ${storeId}-${rootHash}. Pinging update.`);
await withTimeout( digPeer.propagationServer.pingUpdate(rootHash), 15000, `Dig Peer: ${peerIp} took to long to respond to ping request`);
await withTimeout(digPeer.propagationServer.pingUpdate(rootHash), 15000, `Dig Peer: ${peerIp} took to long to respond to ping request`);
// Do NOT mark as checked if peer lacks the rootHash
}
} catch (error: any) {
Expand Down
Loading