Skip to content

Commit 1bb56d9

Browse files
committed
catch cache puts
1 parent dceb47d commit 1bb56d9

File tree

1 file changed

+18
-14
lines changed
  • packages/service-utils/src/cf-worker

1 file changed

+18
-14
lines changed

packages/service-utils/src/cf-worker/index.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,24 @@ export async function authorizeWorker(
5959
get: async (clientId: string) => serviceConfig.kvStore.get(clientId),
6060
put: (clientId: string, teamAndProjectResponse: TeamAndProjectResponse) =>
6161
serviceConfig.ctx.waitUntil(
62-
serviceConfig.kvStore.put(
63-
clientId,
64-
JSON.stringify({
65-
updatedAt: Date.now(),
66-
teamAndProjectResponse,
67-
} satisfies TeamAndProjectCacheWithPossibleTTL),
68-
{
69-
expirationTtl:
70-
serviceConfig.cacheTtlSeconds &&
71-
serviceConfig.cacheTtlSeconds >= DEFAULT_CACHE_TTL_SECONDS
72-
? serviceConfig.cacheTtlSeconds
73-
: DEFAULT_CACHE_TTL_SECONDS,
74-
},
75-
),
62+
serviceConfig.kvStore
63+
.put(
64+
clientId,
65+
JSON.stringify({
66+
updatedAt: Date.now(),
67+
teamAndProjectResponse,
68+
} satisfies TeamAndProjectCacheWithPossibleTTL),
69+
{
70+
expirationTtl:
71+
serviceConfig.cacheTtlSeconds &&
72+
serviceConfig.cacheTtlSeconds >= DEFAULT_CACHE_TTL_SECONDS
73+
? serviceConfig.cacheTtlSeconds
74+
: DEFAULT_CACHE_TTL_SECONDS,
75+
},
76+
)
77+
.catch((e) => {
78+
console.error(e);
79+
}),
7680
),
7781
cacheTtlSeconds: serviceConfig.cacheTtlSeconds ?? DEFAULT_CACHE_TTL_SECONDS,
7882
});

0 commit comments

Comments
 (0)