fixed bugs

This commit is contained in:
Marvin Zhang
2019-07-23 12:44:29 +08:00
parent 1e0449e415
commit 55f8ffa05f
2 changed files with 20 additions and 1 deletions

View File

@@ -13,7 +13,6 @@ FROM alpine:latest
WORKDIR /root
COPY --from=build /go/src/app .
COPY --from=build /go/bin/crawlab /usr/local/bin
RUN ls
EXPOSE 8000
CMD ["crawlab"]

View File

@@ -223,6 +223,26 @@ func UpdateNodeStatus() {
}
}
}
// 遍历数据库中的节点列表
nodes, err := model.GetNodeList(nil)
for _, node := range nodes {
hasNode := false
for _, mac := range list {
if mac == node.Mac {
hasNode = true
break
}
}
if !hasNode {
node.Status = constants.StatusOffline
if err := node.Save(); err != nil {
log.Errorf(err.Error())
return
}
continue
}
}
}
// 更新节点数据