-
Notifications
You must be signed in to change notification settings - Fork 838
nits: warning retry #6760
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
nits: warning retry #6760
Changes from 1 commit
723933c
3206a62
875c11f
ea5d766
6202eaa
8fac8a4
e281aa9
af9cea1
30eae9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,7 @@ | |
| import { StepsInputArgs } from './flows/stepsInputArgs.svelte' | ||
| import { aiChatManager } from './copilot/chat/AIChatManager.svelte' | ||
| import type { GraphModuleState } from './graph' | ||
| import { validateRetryConfig } from '$lib/utils' | ||
| import { | ||
| setStepHistoryLoaderContext, | ||
| StepHistoryLoader, | ||
|
|
@@ -427,6 +428,15 @@ | |
| loadingSave = true | ||
| try { | ||
| const flow = cleanInputs(flowStore.val) | ||
| if (flow.value?.modules) { | ||
| for (const module of flow.value.modules) { | ||
|
||
| const error = validateRetryConfig(module.retry) | ||
| if (error) { | ||
| throw new Error(error) | ||
hugocasa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
| // console.log('flow', computeUnlockedSteps(flow)) // del | ||
| // loadingSave = false // del | ||
| // return | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| import type { FlowEditorContext } from '../types' | ||
| import { getStepPropPicker } from '../previousResults' | ||
| import { NEVER_TESTED_THIS_FAR } from '../models' | ||
| import { validateRetryConfig } from '$lib/utils' | ||
|
|
||
| interface Props { | ||
| flowModuleRetry: Retry | undefined | ||
|
|
@@ -59,6 +60,10 @@ | |
| : NEVER_TESTED_THIS_FAR | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good use of derived stores to show the validation error. Consider if similar validation is needed for the constant retry settings or adding comments to clarify why only the exponential section is validated. |
||
| ) | ||
|
|
||
| let validationError = $derived.by(() => { | ||
| return validateRetryConfig(flowModuleRetry) | ||
| }) | ||
|
|
||
| function setConstantRetries() { | ||
| flowModuleRetry = { | ||
| ...flowModuleRetry, | ||
|
|
@@ -247,7 +252,20 @@ | |
| <span class="text-xs text-tertiary">delay = multiplier * base ^ (number of attempt)</span> | ||
| <input bind:value={flowModuleRetry.exponential.multiplier} type="number" /> | ||
| <div class="text-xs font-bold !mt-2">Base (in seconds)</div> | ||
| <input bind:value={flowModuleRetry.exponential.seconds} type="number" step="1" /> | ||
| <input | ||
| bind:value={flowModuleRetry.exponential.seconds} | ||
| type="number" | ||
| step="1" | ||
| min="1" | ||
| class={validationError ? 'border-red-500' : ''} | ||
| /> | ||
| {#if validationError} | ||
| <span class="text-xs text-red-500">{validationError}</span> | ||
| {:else} | ||
| <span class="text-xs text-tertiary" | ||
| >Must be ≥ 1. A base of 0 would cause immediate retries.</span | ||
| > | ||
| {/if} | ||
| <div class="text-xs font-bold !mt-2">Randomization factor (percentage)</div> | ||
| <div class="flex w-full gap-4"> | ||
| {#if !$enterpriseLicense} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,7 @@ components: | |
| type: integer | ||
| seconds: | ||
| type: integer | ||
| minimum: 1 | ||
| random_factor: | ||
| type: integer | ||
| minimum: 0 | ||
|
|
||
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.
it only go through first level, there is likely a dfs function somewhere however I think it might be the wrong approach, you likely want to try to deserialize each module and fail at first module that can't be deserializing with giving the id + error from the deserializer. Much more generic. You can then just apply a validate function on a FlowModuleValue directly for anything post validation.