Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 280f987

Browse files
committed
chore: better gc logging
1 parent 830b9a1 commit 280f987

File tree

1 file changed

+10
-4
lines changed
  • src/core/components/pin

1 file changed

+10
-4
lines changed

src/core/components/pin/gc.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ function createMarkedSet (ipfs, callback) {
5252
return cb(new Error(`Could not list pinned blocks: ${err.message}`))
5353
}
5454
log(`Found ${pins.length} pinned blocks`)
55-
cb(null, pins.map(p => new CID(p.hash)))
55+
const cids = pins.map(p => new CID(p.hash))
56+
// log(' ' + cids.join('\n '))
57+
cb(null, cids)
5658
}),
5759

5860
// Blocks used internally by the pinner
@@ -61,6 +63,7 @@ function createMarkedSet (ipfs, callback) {
6163
return cb(new Error(`Could not list pinner internal blocks: ${err.message}`))
6264
}
6365
log(`Found ${cids.length} pinner internal blocks`)
66+
// log(' ' + cids.join('\n '))
6467
cb(null, cids)
6568
}),
6669

@@ -92,8 +95,10 @@ function getDescendants (ipfs, cid, callback) {
9295
if (err) {
9396
return callback(new Error(`Could not get MFS root descendants from store: ${err.message}`))
9497
}
95-
log(`Found ${1 + refs.length} MFS blocks`)
96-
callback(null, [cid, ...refs.map(r => new CID(r.ref))])
98+
const cids = [cid, ...refs.map(r => new CID(r.ref))]
99+
log(`Found ${cids.length} MFS blocks`)
100+
// log(' ' + cids.join('\n '))
101+
callback(null, cids)
97102
})
98103
}
99104

@@ -119,9 +124,10 @@ function deleteUnmarkedBlocks (ipfs, markedSet, blocks, start, callback) {
119124
}
120125
}
121126

122-
const msg = `Marked set has ${markedSet.size} blocks. Blockstore has ${blocks.length} blocks. ` +
127+
const msg = `Marked set has ${markedSet.size} unique blocks. Blockstore has ${blocks.length} blocks. ` +
123128
`Deleting ${unreferenced.length} blocks.` + (errCount ? ` (${errCount} errors)` : '')
124129
log(msg)
130+
// log(' ' + unreferenced.join('\n '))
125131

126132
mapLimit(unreferenced, BLOCK_RM_CONCURRENCY, (cid, cb) => {
127133
// Delete blocks from blockstore

0 commit comments

Comments
 (0)