From 876933e2626d6672f9e8aba84d0c9dbe52ac70f6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 3 Nov 2026 06:36:40 -0800 Subject: [PATCH] admin: never let an older plugin monitor refresh replace a newer one The 3 second timer starts a refresh without waiting for the last one, so two refreshes of the same tab can finish out of order and the older rows then replace the newer. Number each refresh and skip the commit when a later one has already landed. Requests slower than the timer still land, since only a completed newer refresh supersedes an older one. Co-Authored-By: Claude Opus 5.5 --- weed/admin/view/app/plugin.templ | 7 ++++++- weed/admin/view/app/plugin_templ.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/weed/admin/view/app/plugin.templ b/weed/admin/view/app/plugin.templ index f0518c95bc..9281e13db6 100644 --- a/weed/admin/view/app/plugin.templ +++ b/weed/admin/view/app/plugin.templ @@ -621,6 +621,8 @@ templ Plugin(page string, initialJob string, lane string) { allJobs: [], allActivities: [], monitorRowsScope: null, + monitorRefreshSeq: 0, + monitorCommittedSeq: 0, refreshError: '', loadedJobType: '', descriptor: null, @@ -3102,6 +3104,7 @@ templ Plugin(page string, initialJob string, lane string) { // cluster, so the job-type sub-tabs fetch their own server-side filtered window. var scopedJobType = monitorJobTypeScope(); var sameScope = state.monitorRowsScope === scopedJobType; + var refreshSeq = ++state.monitorRefreshSeq; // A failed request keeps its last rows; the rest still land and the failure is rethrown. var failure = null; @@ -3130,9 +3133,11 @@ templ Plugin(page string, initialJob string, lane string) { } catch (e) { schedulerStatus = null; } - if (monitorJobTypeScope() !== scopedJobType) { + // Drop a refresh that a newer one already landed before, or that a tab change left behind. + if (refreshSeq < state.monitorCommittedSeq || monitorJobTypeScope() !== scopedJobType) { return; } + state.monitorCommittedSeq = refreshSeq; state.allJobs = Array.isArray(allJobs) ? allJobs : []; state.allActivities = Array.isArray(allActivities) ? allActivities : []; diff --git a/weed/admin/view/app/plugin_templ.go b/weed/admin/view/app/plugin_templ.go index 621a1031a8..04dd86490e 100644 --- a/weed/admin/view/app/plugin_templ.go +++ b/weed/admin/view/app/plugin_templ.go @@ -109,7 +109,7 @@ func Plugin(page string, initialJob string, lane string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
Workers

0

Active Jobs

0

Activities (recent)

0

Next scheduled check

-

Per Job Type Summary
Job TypeActive JobsRecent Activities
Loading...
Scheduler State
Sequential scheduler with per-job runtime limits
Job TypeEnabledDetectorIn FlightMax RuntimeExec GlobalExec/WorkerExecutor WorkersEffective ExecLast Run
Loading...
Workers
WorkerAddressCapabilitiesLoad
Loading...
Job Type Configuration
Not loaded
Selected Job Type
-
Descriptor
Select a job type to load schema and config.
Admin Config Form
No admin form loaded.
Worker Config Form
No worker form loaded.
Job Scheduling Settings
How often to check for new work.
Per-attempt deadline for one job. Size-aware tasks may extend this automatically.
Next scheduled check
Scheduler
-
Not scheduled
Run History
Keep last 10 success + last 10 errors
Successful Runs
TimeJob IDWorkerDuration
No data
Error Runs
TimeJob IDWorkerError
No data
Detection Results
Run detection to see proposals.
Job Queue
States: pending/assigned/running
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Detection Jobs
Detection activities for selected job type
TimeJob TypeRequest IDWorkerStageSourceMessage
Loading...
Execution Jobs
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Execution Activities
Non-detection events only
TimeJob TypeJob IDSourceStageMessage
Loading...
Job Detail
Select a job to view details.
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "
Workers

0

Active Jobs

0

Activities (recent)

0

Next scheduled check

-

Per Job Type Summary
Job TypeActive JobsRecent Activities
Loading...
Scheduler State
Sequential scheduler with per-job runtime limits
Job TypeEnabledDetectorIn FlightMax RuntimeExec GlobalExec/WorkerExecutor WorkersEffective ExecLast Run
Loading...
Workers
WorkerAddressCapabilitiesLoad
Loading...
Job Type Configuration
Not loaded
Selected Job Type
-
Descriptor
Select a job type to load schema and config.
Admin Config Form
No admin form loaded.
Worker Config Form
No worker form loaded.
Job Scheduling Settings
How often to check for new work.
Per-attempt deadline for one job. Size-aware tasks may extend this automatically.
Next scheduled check
Scheduler
-
Not scheduled
Run History
Keep last 10 success + last 10 errors
Successful Runs
TimeJob IDWorkerDuration
No data
Error Runs
TimeJob IDWorkerError
No data
Detection Results
Run detection to see proposals.
Job Queue
States: pending/assigned/running
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Detection Jobs
Detection activities for selected job type
TimeJob TypeRequest IDWorkerStageSourceMessage
Loading...
Execution Jobs
Job IDTypeStateProgressWorkerUpdatedMessage
Loading...
Execution Activities
Non-detection events only
TimeJob TypeJob IDSourceStageMessage
Loading...
Job Detail
Select a job to view details.
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }