Skip to content

Commit

Permalink
fixing fs.cat
Browse files Browse the repository at this point in the history
  • Loading branch information
silkroadnomad committed Dec 21, 2024
1 parent e8015d5 commit 735e2b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions relay/src/pinner/scanBlockchainForNameOps.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,13 @@ async function pinIpfsContent(electrumClient, helia, orbitdb, nameOp, nameId, ip
let metadataContent = '';
let totalSize = 0;
let metadataSize = 0;

const fs = unixfs(helia);
try {
logger.info(`Attempting to retrieve IPFS metadata content with CID: ${cid}`);

// Notify network that we're starting to pin
helia.libp2p.services.pubsub.publish(CONTENT_TOPIC, new TextEncoder().encode("PINNING-CID:" + cid));

const fs = unixfs(helia);

// Measure metadata size
for await (const chunk of fs.cat(CID.parse(cid))) {
metadataContent += new TextDecoder().decode(chunk);
Expand Down Expand Up @@ -245,7 +243,6 @@ async function pinIpfsContent(electrumClient, helia, orbitdb, nameOp, nameId, ip
try {
logger.info(`Measuring file size for CID: ${imageCid}`);
let fileSize = 0;

// Measure actual file size
for await (const chunk of fs.cat(CID.parse(imageCid))) {
fileSize += chunk.length;
Expand Down
2 changes: 1 addition & 1 deletion relay/src/pubsubHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function setupPubsub(helia, orbitdb, pinningService, electrumClient, fsHe
try {
messageObject = JSON.parse(message);
} catch (err) {
logger.warn('Failed to parse message as JSON:', err);
// logger.warn('Failed to parse message as JSON:', err);
}

if (messageObject && topic.startsWith(CONTENT_TOPIC)) {
Expand Down

0 comments on commit 735e2b4

Please sign in to comment.