MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / Start

Method Start

internal/nodes/api_stream.go:40–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (this *APIStream) Start() {
41 events.OnKey(events.EventQuit, this, func() {
42 this.isQuiting = true
43 if this.cancelFunc != nil {
44 this.cancelFunc()
45 }
46 })
47 for {
48 if this.isQuiting {
49 return
50 }
51 err := this.loop()
52 if err != nil {
53 if rpc.IsConnError(err) {
54 remotelogs.Debug("API_STREAM", err.Error())
55 } else {
56 remotelogs.Warn("API_STREAM", err.Error())
57 }
58 time.Sleep(10 * time.Second)
59 continue
60 }
61 time.Sleep(1 * time.Second)
62 }
63}
64
65func (this *APIStream) loop() error {
66 rpcClient, err := rpc.SharedRPC()

Callers 1

TestAPIStream_StartFunction · 0.95

Calls 6

loopMethod · 0.95
OnKeyFunction · 0.92
IsConnErrorFunction · 0.92
DebugFunction · 0.92
WarnFunction · 0.92
ErrorMethod · 0.45

Tested by 1

TestAPIStream_StartFunction · 0.76