Skip to content

feat: add 'poolKey' to create worker - #745

Merged
kallebysantos merged 4 commits into
supabase:mainfrom
kallebysantos:ks/feat-add-worker-pool-key
Sep 23, 2026
Merged

kallebysantos merged 4 commits into
supabase:mainfrom
kallebysantos:ks/feat-add-worker-pool-key

Conversation

@kallebysantos

@kallebysantos kallebysantos commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Towards FUNC-905

What kind of change does this PR introduce?

Feature

What is the current behavior?

Today, the runtime reuses a cached worker based on the servicePath. Two functions in the same folder could wrongly get served by each other's cached worker, and it doesn't allow purging the current code.

What is the new behavior?

Introduces the poolKey, a new optional field you can pass to control that caching yourself, instead of relying on the folder path. Leave it out and nothing changes.

Example
// Bump poolKey on each deploy to force a fresh worker:
await EdgeRuntime.userWorkers.create({
  servicePath: "./functions/my-func",
  poolKey: `my-func:${deploymentVersion}`,
});

// Or give two functions the same poolKey to intentionally share one worker:
await EdgeRuntime.userWorkers.create({ servicePath: "./functions/a", poolKey: "shared-key" });
await EdgeRuntime.userWorkers.create({ servicePath: "./functions/b", poolKey: "shared-key" }); // reuses a's worker

@kallebysantos
kallebysantos marked this pull request as ready for review September 23, 2026 01:00

@satyarohith satyarohith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@satyarohith satyarohith changed the title feat: add 'poo_key' to create worker feat: add 'pool_key' to create worker Sep 23, 2026
@kallebysantos kallebysantos changed the title feat: add 'pool_key' to create worker feat: add 'poolKey' to create worker Sep 23, 2026
@kallebysantos
kallebysantos merged commit e847536 into supabase:main Sep 23, 2026
4 of 5 checks passed
@kallebysantos
kallebysantos deleted the ks/feat-add-worker-pool-key branch September 23, 2026 20:48
@aantti

aantti commented Sep 24, 2026

Copy link
Copy Markdown

Cc @luizfelmach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants