Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/free-task-identifier-cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"graphile-worker": patch
---

Convert an internal cache from using a Map to a WeakMap, fixing a memory leak
impacting users that call Graphile Worker's methods (e.g. `run()`) many times
and provide new options objects each time. Most users will only call `run()`
once so would not be impacted by this.
2 changes: 1 addition & 1 deletion src/taskIdentifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Cache {
lastStr: string | Promise<string>;
lastDigest: TaskDetails | Promise<TaskDetails>;
}
const cacheByOptions = new Map<CompiledSharedOptions, Cache>();
const cacheByOptions = new WeakMap<CompiledSharedOptions, Cache>();

export function getTaskDetails(
compiledSharedOptions: CompiledSharedOptions,
Expand Down
Loading