mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Use for loop instead of promise pool
This commit is contained in:
parent
01a5d15147
commit
b6b4967208
1 changed files with 47 additions and 52 deletions
|
|
@ -3,7 +3,6 @@ import { dirname, basename } from 'path'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import semver from 'semver'
|
import semver from 'semver'
|
||||||
import { PromisePool } from '@supercharge/promise-pool'
|
|
||||||
import memoize from 'fast-memoize'
|
import memoize from 'fast-memoize'
|
||||||
import has from 'just-has'
|
import has from 'just-has'
|
||||||
|
|
||||||
|
|
@ -241,6 +240,7 @@ class BuildLists {
|
||||||
|
|
||||||
// Sort versions by semver
|
// Sort versions by semver
|
||||||
const versions = Object.entries( versionsObject ).sort( ( [ aVersionRaw ], [ bVersionRaw ] ) => {
|
const versions = Object.entries( versionsObject ).sort( ( [ aVersionRaw ], [ bVersionRaw ] ) => {
|
||||||
|
// console.log( 'a, b', aVersionRaw, bVersionRaw )
|
||||||
const aVersion = normalizeVersion( aVersionRaw )
|
const aVersion = normalizeVersion( aVersionRaw )
|
||||||
const bVersion = normalizeVersion( bVersionRaw )
|
const bVersion = normalizeVersion( bVersionRaw )
|
||||||
|
|
||||||
|
|
@ -450,17 +450,16 @@ class BuildLists {
|
||||||
|
|
||||||
const apiListDirectory = `${ apiDirectory }/${ listOptions.endpointPrefix }`
|
const apiListDirectory = `${ apiDirectory }/${ listOptions.endpointPrefix }`
|
||||||
|
|
||||||
const poolSize = 1000
|
// const poolSize = 1000
|
||||||
|
|
||||||
// Store app bundles to memory
|
// Store app bundles to memory
|
||||||
await this.getSavedAppBundles({
|
await this.getSavedAppBundles({
|
||||||
keepBundlesInMemory: true
|
keepBundlesInMemory: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const { errors } = await PromisePool
|
// await Promise.all( this.getListArrayMemoized( listOptions.name ).map( async ( listEntry ) => {
|
||||||
.withConcurrency( poolSize )
|
for ( const listEntry of this.getListArrayMemoized( listOptions.name ) ) {
|
||||||
.for( this.getListArrayMemoized( listOptions.name ) )
|
|
||||||
.process(async ( listEntry, index, pool ) => {
|
|
||||||
// console.log('listEntry', listEntry)
|
// console.log('listEntry', listEntry)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -516,10 +515,6 @@ class BuildLists {
|
||||||
|
|
||||||
// Write the endpoint to JSON
|
// Write the endpoint to JSON
|
||||||
await this.saveToJson( saveableEntry, endpointPath )
|
await this.saveToJson( saveableEntry, endpointPath )
|
||||||
})
|
|
||||||
|
|
||||||
if ( errors.length !== 0 ) {
|
|
||||||
throw new Error( errors )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count saved files
|
// Count saved files
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue