Skip to content

Commit

Permalink
fix: improve no flow overlap + schedule args loading
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Feb 9, 2024
1 parent b230378 commit 48b8520
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/windmill-worker/src/worker_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ async fn push_next_flow_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>
.await?;
if no_flow_overlap {
let count = sqlx::query_scalar!(
"SELECT count(*) FROM queue WHERE schedule_path = $1 AND workspace_id = $2 AND id != $3",
"SELECT count(*) FROM queue WHERE schedule_path = $1 AND workspace_id = $2 AND id != $3 AND running = true",
flow_job.schedule_path.as_ref().unwrap(),
flow_job.workspace_id.as_str(),
flow_job.id
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/RunPageSchedules.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<div class="text-xs text-secondary px-2"> No other schedules </div>
{:else}
<div class="flex flex-col divide-y px-2 pt-2">
{#each schedules as schedule}
{#each schedules as schedule (schedule.path)}
<div class="grid grid-cols-6 text-2xs items-center py-2"
><div class="col-span-3 truncate">{schedule.path}</div><div>{schedule.schedule}</div>
<div>{schedule.enabled ? 'on' : 'off'}</div>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/lib/components/ScheduleEditorInner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
path = initialScriptPath
initialPath = initialScriptPath
script_path = initialScriptPath
loadScript(script_path)
if (defaultErrorHandlerMaybe !== undefined && defaultErrorHandlerMaybe !== null) {
wsErrorHandlerMuted = defaultErrorHandlerMaybe['wsErrorHandlerMuted']
let splitted = (defaultErrorHandlerMaybe['errorHandlerPath'] as string).split('/')
Expand Down Expand Up @@ -151,8 +153,6 @@
let validCRON = true
$: allowSchedule = isValid && validCRON && script_path != ''
$: script_path != '' && loadScript(script_path)
// set isValid to true when a script/flow without any properties is selected
$: runnable?.schema &&
runnable.schema.properties &&
Expand All @@ -163,7 +163,6 @@
async function loadScript(p: string | undefined): Promise<void> {
if (p) {
args = {}
runnable = undefined
if (is_flow) {
runnable = await FlowService.getFlowByPath({ workspace: $workspaceStore!, path: p })
Expand Down Expand Up @@ -242,11 +241,9 @@
schedule = s.schedule
timezone = s.timezone
summary = s.summary ?? ''
let oldScriptPath = script_path
script_path = s.script_path ?? ''
if (oldScriptPath == script_path) {
loadScript(script_path)
}
loadScript(script_path)
is_flow = s.is_flow
no_flow_overlap = s.no_flow_overlap ?? false
wsErrorHandlerMuted = s.ws_error_handler_muted ?? false
Expand Down Expand Up @@ -504,6 +501,9 @@
allowFlow={true}
bind:itemKind
bind:scriptPath={script_path}
on:select={(e) => {
loadScript(e.detail.path)
}}
/>
{:else}
<Alert type="info" title="Runnable path cannot be edited">
Expand Down

0 comments on commit 48b8520

Please sign in to comment.