Skip to content

Commit

Permalink
Adjust tonstorage util
Browse files Browse the repository at this point in the history
Signed-off-by: KayleCoder <[email protected]>
  • Loading branch information
KayleCoder committed Jul 31, 2024
1 parent 03e23bf commit 2395a06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/merkle/tonsutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export async function addTonBag({
files,
donwload_all,
}),
}).then((res: Response) => {
if (res.status == 200) {
return res.json()
} else {
throw new Error(`Call storage api failed: ${res.status}`)
}
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/service/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export async function downloadTorrentHeaders() {
if (result) {
continue;
}
await addTonBag(torrentHash);
await addTonBag({
bag_id: torrentHash,
});
} catch (e) {
logger.error(`Failed to download meta bag ${torrentHash}: ${e.message}`);
const retryTimes = task.download_header_retry_times + 1;
Expand Down

0 comments on commit 2395a06

Please sign in to comment.