Skip to content

Commit

Permalink
Merge pull request #127 from DIG-Network/develop
Browse files Browse the repository at this point in the history
feat: update sdk
  • Loading branch information
MichaelTaylor3D authored Oct 10, 2024
2 parents d30bffc + 8cbd893 commit cb8fe36
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 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
Expand Up @@ -12,7 +12,7 @@
"build": "rm -rf dist && tsc && npm run postbuild",
"postbuild": "copyfiles -u 1 \"src/**/*.crt\" \"src/**/*.key\" dist",
"start": "ts-node src/index.ts",
"dev": "set DIG_USERNAME=1234 && set DIG_PASSWORD=1234 && ts-node src/index.ts",
"dev": "set DIG_USERNAME=1234&& set DIG_PASSWORD=1234&& ts-node src/index.ts",
"server": "ts-node src/server.ts",
"test": "mocha -r ts-node/register tests.ts",
"prepare-release": "bash ./scripts/release.sh"
Expand All @@ -26,7 +26,7 @@
],
"dependencies": {
"@dignetwork/datalayer-driver": "^0.1.28",
"@dignetwork/dig-sdk": "^0.0.1-alpha.167",
"@dignetwork/dig-sdk": "^0.0.1-alpha.169",
"async-mutex": "^0.5.0",
"busboy": "^1.6.0",
"express": "^4.19.2",
Expand Down
24 changes: 14 additions & 10 deletions src/tasks/sync_stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,20 @@ const synchronizeStore = async (
): Promise<void> => {
console.log(`Starting synchronization for store ${storeId}...`);

const isSynced = await isStoreSynced(storeId);

if (isSynced) {
console.log(`Store ${storeId} is synced. Proceeding with peer checks.`);
await handleSyncedStore(storeId, serverCoin);
} else {
console.log(
`Store ${storeId} is not synced. Initiating synchronization from peers.`
);
await syncStoreFromNetwork(storeId);
// Store might have been deleted so just check its still there
// otherwise risk bringing the store back
if (fs.existsSync(path.join(STORE_PATH, storeId))) {
const isSynced = await isStoreSynced(storeId);

if (isSynced) {
console.log(`Store ${storeId} is synced. Proceeding with peer checks.`);
await handleSyncedStore(storeId, serverCoin);
} else {
console.log(
`Store ${storeId} is not synced. Initiating synchronization from peers.`
);
await syncStoreFromNetwork(storeId);
}
}
};

Expand Down

0 comments on commit cb8fe36

Please sign in to comment.