Skip to content

Commit

Permalink
Remove api.audius.co filter (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored and michellebrier committed Oct 9, 2023
1 parent aeade5a commit 1505019
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/protocol-dashboard/src/utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,8 @@ export const withTimeout = async (
// TODO: put in env vars for staging
export const fetchUntilSuccess = async (endpoints: string[]): Promise<any> => {
try {
const response = await fetchWithTimeout('https://api.audius.co')
const allHealthyDps = response.data as string[]
const allowedEndpoints = endpoints.filter(endpoint =>
allHealthyDps.some(url => endpoint.startsWith(url))
)

// Pick a random endpoint from the allowed endpoints
const endpoint =
allowedEndpoints[Math.floor(Math.random() * allowedEndpoints.length)]
const endpoint = endpoints[Math.floor(Math.random() * endpoints.length)]
console.info('Attempting endpoint: ', endpoint)
return await fetchWithTimeout(endpoint)
} catch (e) {
Expand Down

0 comments on commit 1505019

Please sign in to comment.