sepia-search-motore-di-rice.../server/lib/instances-index.ts

22 lines
577 B
TypeScript

import { CONFIG } from '../initializers/constants'
import { doRequest } from '../helpers/requests'
async function listIndexInstancesHost (): Promise<string[]> {
const uri = CONFIG.INSTANCES_INDEX.URL + '/api/v1/instances/hosts'
const qs = { count: 5000 }
const { body } = await doRequest<any>({ uri, qs, json: true })
return body.data.map(o => o.host as string)
}
function getRemovedHosts (dbHosts: string[], indexHosts: string[]) {
return dbHosts.filter(dbHost => indexHosts.includes(dbHost) === false)
}
export {
getRemovedHosts,
listIndexInstancesHost
}