Skip to content

Commit 73b45a4

Browse files
authored
Merge pull request #738 from podverse/develop
Release v4.16.8
2 parents 2d4c6f4 + 46130d6 commit 73b45a4

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "podverse-api",
3-
"version": "4.16.7",
3+
"version": "4.16.8",
44
"description": "Data API, database migration scripts, and backend services for all Podverse models.",
55
"contributors": [
66
"Mitch Downey"

src/lib/utility/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const delimitQueryValues = (ctx, keys) => {
1818
export const chunkArray = (arr, chunkSize = 10) => {
1919
let i
2020
let j
21-
const chunks = []
21+
const chunks: any[] = []
2222
for (i = 0, j = arr.length; i < j; i += chunkSize) {
23-
const chunk = arr.slice(i, i + chunkSize) as never // TODO: What does this mean?
23+
const chunk = arr.slice(i, i + chunkSize) as any[]
2424
chunks.push(chunk)
2525
}
2626
return chunks

src/services/podcastIndex.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { request } from '~/lib/request'
1010
import { getPodcastByPodcastIndexId } from '~/controllers/podcast'
1111
import { Podcast } from '~/entities'
1212
import { ValueTagOriginal } from 'podverse-shared'
13+
import { chunkArray } from '~/lib/utility'
1314
const shortid = require('shortid')
1415
const sha1 = require('crypto-js/sha1')
1516
const encHex = require('crypto-js/enc-hex')
@@ -174,16 +175,19 @@ export const addRecentlyUpdatedFeedUrlsToPriorityQueue = async (sinceTime?: numb
174175
}
175176
}
176177

177-
// TODO: THIS TAKES A VERY LONG TIME TO COMPLETE,
178-
// AND IS ARBITRARILY LIMITED TO 10000...
179-
// const uniquePodcastIndexIds = [...new Set(recentlyUpdatedPodcastIndexIds)].slice(0, 10000)
180-
181-
// console.log('unique recentlyUpdatedPodcastIndexIds count', uniquePodcastIndexIds.length)
182-
183-
// Send the feedUrls with matching podcastIndexIds found in our database to
184-
// the priority parsing queue for immediate parsing.
185-
if (recentlyUpdatedPodcastIndexIds.length > 0) {
186-
await addFeedUrlsByPodcastIndexId(recentlyUpdatedPodcastIndexIds)
178+
const recentlyUpdatedPodcastIndexIdsChunks = chunkArray(recentlyUpdatedPodcastIndexIds, 500)
179+
console.log('recentlyUpdatedPodcastIndexIdsChunks array count', recentlyUpdatedPodcastIndexIdsChunks.length)
180+
let chunkIndex = 0
181+
for (const chunk of recentlyUpdatedPodcastIndexIdsChunks) {
182+
try {
183+
chunkIndex++
184+
console.log('sending feedUrls chunk to queue...', chunkIndex)
185+
if (chunk.length > 0) {
186+
await addFeedUrlsByPodcastIndexId(chunk)
187+
}
188+
} catch (error) {
189+
console.log('addFeedUrlsByPodcastIndexId error:', error)
190+
}
187191
}
188192
} catch (error) {
189193
console.log('addRecentlyUpdatedFeedUrlsToPriorityQueue', error)

0 commit comments

Comments
 (0)