feat: use bulk Spotify API calls & inserts to make spotify crawling more efficient (#271)

* feat(spotify-api): bulk endpoints
* feat(music-library): allow bulk operations
* feat(spotify): bulk track+album+artist+genre import
* feat(spotify): use bulk import api for user crawl
* feat(spotify): bulk listen insert

For the benchmark case of a new user where Listory imports 50 new listens along with all now tracks, artists, albums & genres we significantly reduced the number of things happening:

    Spotify API Requests: 208 => 8
    DB Insert: 96 => 8
    Tracing Spans: 1953 => 66
This commit is contained in:
Julian Tölle 2023-05-07 02:20:43 +02:00 committed by GitHub
parent 24b7308343
commit 8721fd101d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 427 additions and 23 deletions

14
package-lock.json generated
View file

@ -45,6 +45,7 @@
"class-validator": "0.14.0",
"cookie-parser": "1.4.6",
"date-fns": "2.30.0",
"lodash": "^4.17.21",
"nest-raven": "9.2.0",
"nestjs-otel": "5.1.2",
"nestjs-pino": "3.2.0",
@ -70,6 +71,7 @@
"@types/express": "4.17.17",
"@types/hapi__joi": "17.1.9",
"@types/jest": "29.5.1",
"@types/lodash": "^4.14.194",
"@types/long": "4.0.2",
"@types/node": "18.16.5",
"@types/passport-http-bearer": "^1.0.37",
@ -3794,6 +3796,12 @@
"@types/koa": "*"
}
},
"node_modules/@types/lodash": {
"version": "4.14.194",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.194.tgz",
"integrity": "sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==",
"dev": true
},
"node_modules/@types/long": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
@ -15724,6 +15732,12 @@
"@types/koa": "*"
}
},
"@types/lodash": {
"version": "4.14.194",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.194.tgz",
"integrity": "sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==",
"dev": true
},
"@types/long": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",