Skip to content

Commit

Permalink
remove getEntityCounts - no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
rosado committed Jan 17, 2025
1 parent 64213eb commit 78d70f8
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/services/performanceDbApi.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Performance DB API service
*/
import datasette from './datasette.js'
import logger from '../utils/logger.js'
import { types } from '../utils/logging.js'

Expand Down Expand Up @@ -284,36 +283,6 @@ export default {
order by dataset asc`
},

/**
*
* @param {{resource: string, dataset: string}[]} resources
* @param {{ req?: import('express').Request}}
* @returns {Promise<{ resource: string, dataset: string, entityCount?: number}[]>}
*/
async getEntityCounts (resources, opts = {}) {
const requests = resources.map(({ resource, dataset }) => {
const q = datasette.runQuery(this.entityCountQuery(resource), dataset, opts)
return q
.then(result => {
if (result.formattedData.length === 0) {
logger.info({ message: 'getEntityCounts(): No results for resource.', resource, dataset, type: types.App })
return { resource, dataset }
}
return { resource, dataset, entityCount: result.formattedData[0].entity_count }
})
.catch((error) => {
logger.warn('getEntityCounts(): could not obtain entity counts. Proceeding without them.',
{ type: types.App, errorMessage: error.message, errorStack: error.stack })
return { resource, dataset }
})
})

const results = await Promise.allSettled(requests)
return results
.filter(p => p.status === 'fulfilled')
.map(p => p.value)
},

getEntitiesWithIssuesCountQuery: (req) => {
const { issue_type: issueType, issue_field: issueField } = req.params
const { resource: resourceId } = req.resource
Expand Down

0 comments on commit 78d70f8

Please sign in to comment.