Re-enable cache server

This commit is contained in:
Pieter Vander Vennet 2024-04-30 23:14:57 +02:00
parent 7d313fedf8
commit 2526bc15bf
5 changed files with 13 additions and 5 deletions

View file

@ -9,4 +9,4 @@ For used hosts, see the Caddyfile
As the ISP of Nerdlab is a bit picky, we use SSH-port-forwarding on the cache server:
`ssh -R `
`ssh -R 5445:127.0.0.1:5445 hetzner`

View file

@ -38,6 +38,7 @@ class OsmPoiDatabase {
this._client = new Client(connectionString)
}
async getCount(
layer: string,
bbox: [[number, number], [number, number]] = undefined

View file

@ -1042,7 +1042,14 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
Utils._download_cache.set(url, { promise, timestamp: new Date().getTime() })
return await promise
}
public static async downloadJson(
url: string,
headers?: Record<string, string>
): Promise<object | []>
public static async downloadJson<T>(
url: string,
headers?: Record<string, string>
): Promise<T>
public static async downloadJson(
url: string,
headers?: Record<string, string>

View file

@ -30,8 +30,8 @@ async function getAvailableLayers(): Promise<Set<string>> {
try {
const host = new URL(Constants.VectorTileServer).host
const status: { layers: string[] } = await Promise.any([
// Utils.downloadJson("https://" + host + "/summary/status.json"),
timeout(0),
Utils.downloadJson<{layers}>("https://" + host + "/summary/status.json"),
timeout(2500),
])
return new Set<string>(status.layers)
} catch (e) {

View file

@ -29,7 +29,7 @@ async function getAvailableLayers(): Promise<Set<string>> {
try {
const host = new URL(Constants.VectorTileServer).host
const status = await Promise.any([
// Utils.downloadJson("https://" + host + "/summary/status.json"),
Utils.downloadJson("https://" + host + "/summary/status.json"),
timeout(0)
])
return new Set<string>(status.layers)