mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-30 00:40:44 +01:00
* plugin: describe detection cooldowns and report skipped scans * admin: expose cooldown eligibility and preserve skipped detection outcomes * admin: show cooldown eligibility alongside maintenance lock waits * plugin: retain cooldown activity for older admin servers * admin: keep manual detection skips out of scheduler run state * plugin: refresh descriptors on reconnect without downgrading saved schemas * plugin: allow valid schema refreshes to repair corrupt descriptors * admin: store eligible_after activity detail as RFC3339 * worker: report admin_script interval skips as skipped detection * worker: report admin_script interval skips after the last completed job * admin: show the selected job's cooldown while scheduling is disabled * admin: report an unsigned interval skip instead of a completed scan * worker: populate new DetectionComplete fields in Rust senders Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package plugin
|
|
|
|
import (
|
|
"context"
|
|
"sort"
|
|
"time"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/plugin_pb"
|
|
)
|
|
|
|
const descriptorPrefetchTimeout = 20 * time.Second
|
|
|
|
func (r *Plugin) prefetchDescriptorsFromHello(hello *plugin_pb.WorkerHello) {
|
|
if hello == nil || hello.WorkerId == "" || len(hello.Capabilities) == 0 {
|
|
return
|
|
}
|
|
|
|
jobTypeSet := make(map[string]struct{})
|
|
for _, capability := range hello.Capabilities {
|
|
if capability == nil || capability.JobType == "" {
|
|
continue
|
|
}
|
|
if !capability.CanDetect && !capability.CanExecute {
|
|
continue
|
|
}
|
|
jobTypeSet[capability.JobType] = struct{}{}
|
|
}
|
|
|
|
if len(jobTypeSet) == 0 {
|
|
return
|
|
}
|
|
|
|
jobTypes := make([]string, 0, len(jobTypeSet))
|
|
for jobType := range jobTypeSet {
|
|
jobTypes = append(jobTypes, jobType)
|
|
}
|
|
sort.Strings(jobTypes)
|
|
|
|
for _, jobType := range jobTypes {
|
|
select {
|
|
case <-r.shutdownCh:
|
|
return
|
|
default:
|
|
}
|
|
|
|
ctx, cancel := context.WithTimeout(r.ctx, descriptorPrefetchTimeout)
|
|
_, err := r.requestConfigSchema(ctx, jobType, true, hello.WorkerId)
|
|
cancel()
|
|
if err != nil {
|
|
glog.V(1).Infof("Plugin descriptor prefetch skipped for %s: %v", jobType, err)
|
|
continue
|
|
}
|
|
|
|
glog.V(1).Infof("Plugin descriptor prefetched for job_type=%s", jobType)
|
|
}
|
|
}
|