Skip to content

Commit

Permalink
fix: pin normalize should filter out unexpected pin status (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored Nov 23, 2021
1 parent 547f466 commit f8c78b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/api/test/fixtures/postgres/find-content-by-cid.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"peerName": "who?",
"region": "where?"
}
},
{
"status": "PinError",
"updated": "2021-07-14T19:27:14.934572Z",
"location": {
"peerId": "12D3KooWR1Js",
"peerName": "who?",
"region": "where?"
}
}
]
}
8 changes: 7 additions & 1 deletion packages/db/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
])

0 comments on commit f8c78b4

Please sign in to comment.