Skip to content

Commit

Permalink
fix: removes urlCache functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed Nov 29, 2023
1 parent aba4db6 commit 7398815
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions agenta-web/src/lib/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ export const getVariantParametersFromOpenAPI = async (
}
}

// Define a type for our cache
interface Cache {
[key: string]: string
}

// Create the cache object
const urlCache: Cache = {}

/**
* Retries the container url for an app
* @param {string} appId - The id of the app
Expand All @@ -192,21 +184,10 @@ export const getAppContainerURL = async (
throw new Error("Environment variable NEXT_PUBLIC_AGENTA_API_URL is not set.")
}

let cacheKey = appId
if (variantId) cacheKey += `_${variantId}`
if (baseId) cacheKey += `_${baseId}`

// Check if the URL is already cached
if (urlCache[cacheKey]) {
return urlCache[cacheKey]
}

// Retrieve container URL from backend
const url = `${process.env.NEXT_PUBLIC_AGENTA_API_URL}/api/containers/container_url/`
const response = await axios.get(url, {params: {variant_id: variantId, base_id: baseId}})
if (response.status === 200 && response.data && response.data.uri) {
// Cache the URL before returning
urlCache[cacheKey] = response.data.uri
return response.data.uri
} else {
return ""
Expand Down

0 comments on commit 7398815

Please sign in to comment.