mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 19:01:08 +00:00
cf set cache size explicitly
This commit is contained in:
@@ -21,8 +21,6 @@ import s3client from "/var/runtime/node_modules/aws-sdk/clients/s3.js";
|
|||||||
|
|
||||||
const keepAliveAgent = new https.Agent({ keepAlive: true, maxSockets: 1 });
|
const keepAliveAgent = new https.Agent({ keepAlive: true, maxSockets: 1 });
|
||||||
|
|
||||||
var start;
|
|
||||||
|
|
||||||
// the region should default to the same one as the function
|
// the region should default to the same one as the function
|
||||||
const s3 = new s3client({
|
const s3 = new s3client({
|
||||||
httpOptions: { agent: keepAliveAgent },
|
httpOptions: { agent: keepAliveAgent },
|
||||||
@@ -42,7 +40,7 @@ async function nativeDecompress(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lambda needs to run with 512MB, empty function takes about 70
|
// Lambda needs to run with 512MB, empty function takes about 70
|
||||||
const CACHE = new ResolvedValueCache(256000000, undefined, nativeDecompress);
|
const CACHE = new ResolvedValueCache(undefined, undefined, nativeDecompress);
|
||||||
|
|
||||||
// duplicated code below
|
// duplicated code below
|
||||||
export const pmtiles_path = (name: string, setting?: string): string => {
|
export const pmtiles_path = (name: string, setting?: string): string => {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ async function nativeDecompress(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CACHE = new ResolvedValueCache(undefined, undefined, nativeDecompress);
|
const CACHE = new ResolvedValueCache(25, undefined, nativeDecompress);
|
||||||
|
|
||||||
class R2Source implements Source {
|
class R2Source implements Source {
|
||||||
env: Env;
|
env: Env;
|
||||||
@@ -195,15 +195,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: optimize by making decompression optional
|
|
||||||
const tiledata = await p.getZxy(tile[0], tile[1], tile[2]);
|
const tiledata = await p.getZxy(tile[0], tile[1], tile[2]);
|
||||||
|
|
||||||
switch (p_header.tileType) {
|
switch (p_header.tileType) {
|
||||||
case TileType.Mvt:
|
case TileType.Mvt:
|
||||||
cacheable_headers.set(
|
cacheable_headers.set("Content-Type", "application/x-protobuf");
|
||||||
"Content-Type",
|
|
||||||
"application/x-protobuf"
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case TileType.Png:
|
case TileType.Png:
|
||||||
cacheable_headers.set("Content-Type", "image/png");
|
cacheable_headers.set("Content-Type", "image/png");
|
||||||
|
|||||||
Reference in New Issue
Block a user