moar logs

This commit is contained in:
ntr committed 2022-08-30 18:39:22 +10:00
1 parent 70cb07ee27
commit 44c83d3b33
9 files changed
+113 -22

No files matched your search

+4 -1
View File
@@ -7,7 +7,7 @@ import Bluebird from 'bluebird';
import type Log from 'bunyan';
import type { PrismaClient, Want, User, Listing } from '@prisma/client';
import { logAxiosError } from './utils';
import { logAxiosError, wantDetails } from './utils';
import { Pg } from './pg';
// margh
@@ -39,6 +39,8 @@ export default function createDiscogs(log: Log, pg: Pg) {
const { data: { wants, pagination }} = await api.get(`${apiBase}/users/${username}/wants`);
const releases = await Promise.all(wants.map(want => release(want.id)));
log.info({ wants: wants.length, user: username, userId: user.id }, 'fetched discogs wantlist');
// TODO filter releases to be vinyl format only
// convert want object to actual release and ignore duplicate errors
@@ -83,6 +85,7 @@ export default function createDiscogs(log: Log, pg: Pg) {
// preferentially take listings from sellers if we hit req limits
log.info({ listings: ids.length, ...wantDetails(want)}, 'found listings');
return Bluebird.mapSeries(ids, async id => listing(id, want));
}