Small update to c236bf3

This probably isn't fixing a bug, but better safe than sorry.
This commit is contained in:
Christopher Gurnee 2022-03-05 09:58:14 -05:00
parent 6c83b19767
commit 1b156c5f56

View file

@ -35,9 +35,8 @@ class ChunkedQueue {
this._chunks.push([x])
}
hasFullChunk() {
return this._chunks[0].length >= this._chunkSize
}
hasFullChunk = () => this._chunks[0].length >= this._chunkSize
isEmpty = () => this._chunks[0].length == 0
shiftChunk() {
const first = this._chunks.shift()
@ -45,12 +44,6 @@ class ChunkedQueue {
this._chunks.push([])
return first
}
shiftAll() {
const all = this._chunks.flat()
this._chunks = [[]]
return all
}
}
class Thread extends React.Component {
@ -217,7 +210,8 @@ class Thread extends React.Component {
console.log('Pushshift:', lengths.reduce((a,b) => a+b, 0), 'comments')
// All comments from Pushshift have been processed; wait for Reddit to finish
doRedditComments(redditIdQueue.shiftAll())
while (!redditIdQueue.isEmpty())
doRedditComments(redditIdQueue.shiftChunk())
Promise.all(redditPromises).then(lengths => {
console.log('Reddit:', lengths.reduce((a,b) => a+b, 0), 'comments')
if (!redditError) {