handle weird rejected private listings

This commit is contained in:
ntr committed 2023-02-10 17:32:50 +11:00
1 parent 2dbbf75369
commit 19e0376edf
2 files changed
+16 -1

No files matched your search

+15 -1
View File
@@ -111,7 +111,21 @@ export default function createDiscogs(log: Log, pg: Pg) {
if (unlisted) log.info({ unlisted: unlisted, ...wantDetails(want) }, 'missing listings removed');
// preferentially take listings from sellers if we hit req limits
return Bluebird.mapSeries(ids, async id => listing(id, want));
// sometimes we get dodgy listings from discogs that throw perm errors
// we just want to ignore them
const results = await Promise.allSettled(ids.map(id => listing(id, want)));
// @ts-ignore
const validListings = results
.map(r => {
if (r.status === 'fulfilled') return r.value;
if (r.reason.message.includes('rate limited')) throw r.reason;
return null
})
.filter(v => v);
return validListings;
}
async function listing(id, want) {
+1
View File
@@ -18,6 +18,7 @@ const Info = () => {
<h2>How It Works</h2>
<p> First, add some records to your <span class='alt'>List</span> on the <a href='/search'>Search Page</a>. </p>
<p> Mates Crates will then make <span class='alt'>Offers</span> to you for releases you add to your <a href='/list'>List</a>. </p>
<p> (this can take a few minutes time!) </p>
<p> Select all <span class='alt'>Offers</span> you are interested in, the more you accept the more likely the item will be <span class='alt-text'>Confirmed</span>.</p>
<p> Check back regularly for updated <span class='alt'>Offers</span>, the global record marketplace is a living thing. </p>
</section>