-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow setting compute multiplier on functions #2912
Conversation
Pull Request Test Coverage Report for Build 12002617002Details
💛 - Coveralls |
@@ -156,7 +156,8 @@ Deno.serve({ | |||
console.error(`serving the request with ${servicePath}`); | |||
|
|||
// Ref: https://supabase.com/docs/guides/functions/limits | |||
const memoryLimitMb = 256; | |||
const computeMultiplier = Math.max(Math.min(parseFloat(functionsConfig[functionName].computeMultiplier ?? '1'), 4), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const computeMultiplier = Math.max(Math.min(parseFloat(functionsConfig[functionName].computeMultiplier ?? '1'), 4), 1) | |
const computeMultiplier = Math.max(Math.min(functionsConfig[functionName].computeMultiplier ?? 1, 4), 1) |
No need to parse from string because serialised json already sets this field as number.
Should also update the type definition for functionConfig
https://github.com/supabase/cli/pull/2912/files#diff-44113b100b5a3840b42b5d08768b70a8f82055f9a7d11b37f31e2ea72d51e50dR52
computeMultiplier?: number
Optionally, consider emitting a log message when this value is clamped so users are aware of this limit when serving locally, ie. 1 <= x <=4. Otherwise the only way to know is via the api error when deploying.
VerifyJwt: function.VerifyJWT, | ||
ImportMapPath: toFileURL(function.ImportMap), | ||
EntrypointPath: toFileURL(function.Entrypoint), | ||
ComputeMultiplier: computeMultiplier, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ComputeMultiplier: computeMultiplier, | |
ComputeMultiplier: function.ComputeMultiplier, |
VerifyJwt: function.VerifyJWT, | ||
ImportMapPath: toFileURL(function.ImportMap), | ||
EntrypointPath: toFileURL(function.Entrypoint), | ||
ComputeMultiplier: computeMultiplier, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ComputeMultiplier: computeMultiplier, | |
ComputeMultiplier: function.ComputeMultiplier, |
@@ -44,6 +44,7 @@ func (s *EdgeRuntimeAPI) UpsertFunctions(ctx context.Context, functionConfig con | |||
continue | |||
} | |||
} | |||
computeMultiplier := function.ComputeMultiplier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computeMultiplier := function.ComputeMultiplier |
nitpick for consistency with how other configs are accessed
I'm closing this for now until we figure out some internal decisions. |
What kind of change does this PR introduce?
Introduce compute multiplier setting on Edge Functions.