Skip to content

Commit

Permalink
fix: 节点断开后列表还显示
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Nov 22, 2023
1 parent 512b1f2 commit c3047fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/workhub/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func Connect(ws *websocket.Conn, rq *ConnectParam) error {

func Receiver(worker *Worker) error {

defer DeleteWorker(worker)

recv := &RecvPod{worker}
resp := &RespPod{worker}

defer delete(workerPool, worker.WorkerId)

for {
var rq *SocketData

Expand Down
4 changes: 4 additions & 0 deletions module/workhub/poolman.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ package workhub

import (
"time"

"github.com/opentdp/go-helper/logman"
)

var workerResp = map[uint]any{}
var workerPool = map[string]*Worker{}

func DeleteWorker(Worker *Worker) {

logman.Info("Worker disconnect", "Id", Worker.WorkerId)

if Worker.WorkerId != "" {
delete(workerPool, Worker.WorkerId)
}
Expand Down

0 comments on commit c3047fb

Please sign in to comment.