Skip to content

Commit b47b9b5

Browse files
vicb314systems
andauthored
misc minor refactoring (#1239)
Co-authored-by: Akihiro Nagai <77012577+314systems@users.noreply.github.com>
1 parent 1b8ff91 commit b47b9b5

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

packages/cloudflare/src/api/durable-objects/queue.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ export class DOQueueHandler extends DurableObject<CloudflareEnv> {
4040

4141
constructor(ctx: DurableObjectState, env: CloudflareEnv) {
4242
super(ctx, env);
43-
this.service = env.WORKER_SELF_REFERENCE!;
4443
// If there is no service binding, we throw an error because we can't revalidate without it
45-
if (!this.service) throw new IgnorableError("No service binding for cache revalidation worker");
44+
if (!env.WORKER_SELF_REFERENCE) {
45+
throw new IgnorableError("No service binding for cache revalidation worker");
46+
}
47+
this.service = env.WORKER_SELF_REFERENCE;
4648
this.sql = ctx.storage.sql;
4749

4850
this.maxRevalidations = env.NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION

packages/cloudflare/src/api/overrides/tag-cache/tag-cache-filter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface WithFilterOptions {
1111
* @param tag The tag to filter.
1212
* @returns true if the tag should be forwarded, false otherwise.
1313
*/
14-
filterFn: (tag: string | NextModeTagCacheWriteInput) => boolean;
14+
filterFn: (tag: NextModeTagCacheWriteInput) => boolean;
1515
}
1616

1717
/**
@@ -69,7 +69,7 @@ export function withFilter({ tagCache, filterFn }: WithFilterOptions): NextModeT
6969
* This is used to filter out internal soft tags.
7070
* Can be used if `revalidatePath` is not used.
7171
*/
72-
export function softTagFilter(tag: string | NextModeTagCacheWriteInput): boolean {
72+
export function softTagFilter(tag: NextModeTagCacheWriteInput): boolean {
7373
if (typeof tag === "string") {
7474
return !tag.startsWith("_N_T_");
7575
}

0 commit comments

Comments
 (0)