diff --git a/packages/api/test/fixtures/postgres/find-content-by-cid.json b/packages/api/test/fixtures/postgres/find-content-by-cid.json index a1a1b5ed24..7dcbe9a184 100644 --- a/packages/api/test/fixtures/postgres/find-content-by-cid.json +++ b/packages/api/test/fixtures/postgres/find-content-by-cid.json @@ -10,6 +10,15 @@ "peerName": "who?", "region": "where?" } + }, + { + "status": "PinError", + "updated": "2021-07-14T19:27:14.934572Z", + "location": { + "peerId": "12D3KooWR1Js", + "peerName": "who?", + "region": "where?" + } } ] } diff --git a/packages/db/utils.js b/packages/db/utils.js index d6d3897039..c985c79f55 100644 --- a/packages/db/utils.js +++ b/packages/db/utils.js @@ -43,5 +43,11 @@ export function normalizePins (pins) { peerId: pin.location.peerId, peerName: pin.location.peerName, region: pin.location.region - })) + })).filter(pin => PIN_STATUS.has(pin.status)) } + +const PIN_STATUS = new Set([ + 'Pinned', + 'Pinning', + 'PinQueued' +])