MCPcopy
hub / github.com/seaweedfs/seaweedfs / Run

Method Run

weed/plugin/worker/worker.go:166–189  ·  view source on GitHub ↗

Run keeps the plugin worker connected and reconnects on stream failures.

(ctx context.Context)

Source from the content-addressed store, hash-verified

164
165// Run keeps the plugin worker connected and reconnects on stream failures.
166func (w *Worker) Run(ctx context.Context) error {
167 adminAddress := pb.ServerToGrpcAddress(w.opts.AdminServer)
168
169 for {
170 select {
171 case <-ctx.Done():
172 return nil
173 default:
174 }
175
176 if err := w.runOnce(ctx, adminAddress); err != nil {
177 if ctx.Err() != nil {
178 return nil
179 }
180 glog.Warningf("Plugin worker %s stream ended: %v", w.workerID, err)
181 }
182
183 select {
184 case <-ctx.Done():
185 return nil
186 case <-time.After(w.opts.ReconnectDelay):
187 }
188 }
189}
190
191func (w *Worker) runOnce(ctx context.Context, adminAddress string) error {
192 defer w.setConnected(false)

Callers 15

NewHarnessFunction · 0.95
startMiniPluginWorkerFunction · 0.95
mainFunction · 0.45
TestFilterEventTypesFunction · 0.45
TestFilterPathPrefixesFunction · 0.45
TestFilterCombinedFunction · 0.45
TestConfigValidationFunction · 0.45
setupWatermillQueueMethod · 0.45

Calls 5

runOnceMethod · 0.95
ServerToGrpcAddressFunction · 0.92
WarningfFunction · 0.92
ErrMethod · 0.65
DoneMethod · 0.45