cleanup config client
This commit is contained in:
parent
d3126446f7
commit
07c2ea7adb
11
ttd.go
11
ttd.go
@ -138,6 +138,7 @@ func (s *ServerTTD) HeartBeat(stop chan struct{}) {
|
|||||||
s.UpdateDate()
|
s.UpdateDate()
|
||||||
s.UpdateClients()
|
s.UpdateClients()
|
||||||
s.UpdateCompanies()
|
s.UpdateCompanies()
|
||||||
|
s.UpdateConfigClients()
|
||||||
s.PruneClients()
|
s.PruneClients()
|
||||||
s.PruneCompanies()
|
s.PruneCompanies()
|
||||||
s.ComputeClientTime()
|
s.ComputeClientTime()
|
||||||
@ -565,6 +566,16 @@ func (s *ServerTTD) UpdateCompanies() {
|
|||||||
s.Status.UpdateCompanies = time.Now()
|
s.Status.UpdateCompanies = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ServerTTD) UpdateConfigClients() {
|
||||||
|
for _, cc := range cfg.Clients {
|
||||||
|
if cc.CompanyID != 255 {
|
||||||
|
if _, ok := srv.Status.Companies[cc.CompanyID]; !ok {
|
||||||
|
cc.CompanyID = 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *ServerTTD) PruneClients() {
|
func (s *ServerTTD) PruneClients() {
|
||||||
for cltID, clt := range s.Status.Clients {
|
for cltID, clt := range s.Status.Clients {
|
||||||
if clt.LastSeen.Add(2 * updateHeartBeat).Before(time.Now()) {
|
if clt.LastSeen.Add(2 * updateHeartBeat).Before(time.Now()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||||
package main
|
package main
|
||||||
var githash = "3ddb733"
|
var githash = "d312644"
|
||||||
var buildstamp = "2021-11-22_10:20:29"
|
var buildstamp = "2021-11-26_00:22:05"
|
||||||
var commits = "204"
|
var commits = "205"
|
||||||
var version = "3ddb733-b204 - 2021-11-22_10:20:29"
|
var version = "d312644-b205 - 2021-11-26_00:22:05"
|
||||||
|
Loading…
Reference in New Issue
Block a user