MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / updateServerStatus

Method updateServerStatus

plugin/minecraftobserver/store.go:91–107  ·  view source on GitHub ↗

更新服务器状态

(ss *serverStatus)

Source from the content-addressed store, hash-verified

89
90// 更新服务器状态
91func (d *db) updateServerStatus(ss *serverStatus) (err error) {
92 if d == nil {
93 return errDBConn
94 }
95 d.statusLock.Lock()
96 defer d.statusLock.Unlock()
97 if ss == nil || ss.ServerAddr == "" {
98 return errParam
99 }
100 ss.LastUpdate = time.Now().Unix()
101 ss2 := ss.deepCopy()
102 if err = d.sdb.Where(&serverStatus{ServerAddr: ss.ServerAddr}).Assign(ss2).FirstOrCreate(ss).Debug().Error; err != nil {
103 // logrus.Errorln(logPrefix, fmt.Sprintf("updateServerStatus %v ERROR: %v", ss, err))
104 return
105 }
106 return
107}
108
109func (d *db) delServerStatus(addr string) (err error) {
110 if d == nil {

Callers 4

Test_DAOFunction · 0.80
initFunction · 0.80
singleServerScanFunction · 0.80
Test_singleServerScanFunction · 0.80

Calls 1

deepCopyMethod · 0.80

Tested by 2

Test_DAOFunction · 0.64
Test_singleServerScanFunction · 0.64