From 4a1b50b7a7c451671844e5d1713a520508c61762 Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Mon, 4 Mar 2024 16:16:04 -0300 Subject: [PATCH] Rebase with main Signed-off-by: Marcos Candeia --- blocks/loader.ts | 2 +- runtime/caches/fileSystem.ts | 20 ++++++++++++-------- runtime/caches/s3.ts | 5 +++-- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/blocks/loader.ts b/blocks/loader.ts index b092ef140..816c796b4 100644 --- a/blocks/loader.ts +++ b/blocks/loader.ts @@ -6,7 +6,7 @@ import { singleFlight } from "../engine/core/utils.ts"; import { ResolverMiddlewareContext } from "../engine/middleware.ts"; import { meter } from "../observability/otel/metrics.ts"; import { caches as cachesKV } from "../runtime/caches/denoKV.ts"; -import { caches as cachesFileSystem } from "../runtime/caches/fileSystem.ts" +import { caches as cachesFileSystem } from "../runtime/caches/fileSystem.ts"; import { HttpContext } from "./handler.ts"; import { applyProps, diff --git a/runtime/caches/fileSystem.ts b/runtime/caches/fileSystem.ts index 8e433d863..d3b1dc22d 100644 --- a/runtime/caches/fileSystem.ts +++ b/runtime/caches/fileSystem.ts @@ -6,15 +6,19 @@ import { assertNoOptions, withCacheNamespace, } from "./common.ts"; -import {existsSync} from "https://deno.land/std/fs/mod.ts"; +import { existsSync } from "https://deno.land/std/fs/mod.ts"; -const FILE_SYSTEM_CACHE_DIRECTORY = Deno.env.get("FILE_SYSTEM_CACHE_DIRECTORY") ?? undefined; +const FILE_SYSTEM_CACHE_DIRECTORY = + Deno.env.get("FILE_SYSTEM_CACHE_DIRECTORY") ?? undefined; -const downloadDuration = meter.createHistogram("file_system_cache_download_duration", { - description: "file system cache download duration", - unit: "ms", - valueType: ValueType.DOUBLE, -}); +const downloadDuration = meter.createHistogram( + "file_system_cache_download_duration", + { + description: "file system cache download duration", + unit: "ms", + valueType: ValueType.DOUBLE, + }, +); const bufferSizeSumObserver = meter.createUpDownCounter("buffer_size_sum", { description: "Sum of buffer sizes", @@ -119,7 +123,7 @@ function createFileSystemCache(): CacheStorage { const downloadDurationTime = performance.now() - startTime; span.addEvent("file-system-get-data"); - + if (data === null) { span.addEvent("cache-miss"); return undefined; diff --git a/runtime/caches/s3.ts b/runtime/caches/s3.ts index deceebd33..aae015fac 100644 --- a/runtime/caches/s3.ts +++ b/runtime/caches/s3.ts @@ -18,8 +18,9 @@ import { init as initZstd, } from "https://denopkg.com/mcandeia/zstd-wasm@0.20.2/deno/zstd.ts"; -const MAX_UNCOMPRESSED_SIZE = - parseInt(Deno.env.get("CACHE_AWS_MAX_UNCOMPRESSED_SIZE")! ?? "645120"); +const MAX_UNCOMPRESSED_SIZE = parseInt( + Deno.env.get("CACHE_AWS_MAX_UNCOMPRESSED_SIZE")! ?? "645120", +); const zstdPromise = initZstd();