Compare commits
3 Commits
ce86e0bf72
...
bef684b3fe
| Author | SHA1 | Date | |
|---|---|---|---|
| bef684b3fe | |||
| d8156a96ee | |||
| e0ab399a9c |
@ -119,10 +119,6 @@ func (pe *prometheusExporter) loop(ctx context.Context) {
|
||||
case nm := <-pe.registerChan:
|
||||
var nextmetrics map[string]*prometheusMetricDesc
|
||||
if collector != nil {
|
||||
if collector.metrics[nm.key] != nil {
|
||||
break
|
||||
}
|
||||
|
||||
nextmetrics = collector.metrics
|
||||
prometheus.Unregister(collector)
|
||||
nextmetrics[nm.key] = nm
|
||||
@ -132,12 +128,14 @@ func (pe *prometheusExporter) loop(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
collector = &prometheusCollector{
|
||||
nextcollector := &prometheusCollector{
|
||||
metrics: nextmetrics,
|
||||
}
|
||||
|
||||
if err := prometheus.Register(collector); err != nil {
|
||||
if err := prometheus.Register(nextcollector); err != nil {
|
||||
logger.Error("prometheus register err :", *nm, err)
|
||||
} else {
|
||||
collector = nextcollector
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,8 +3,6 @@ package gocommon
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"repositories.action2quare.com/ayo/gocommon/flagx"
|
||||
@ -18,10 +16,10 @@ func configFilePath() string {
|
||||
configfilepath = *configfileflag
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(configfilepath, "/") {
|
||||
exe, _ := os.Executable()
|
||||
configfilepath = path.Join(path.Dir(exe), configfilepath)
|
||||
}
|
||||
// if !strings.HasPrefix(configfilepath, "/") {
|
||||
// exe, _ := os.Executable()
|
||||
// configfilepath = path.Join(path.Dir(exe), configfilepath)
|
||||
// }
|
||||
|
||||
return configfilepath
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ func (ws *WebsocketHandler) mainLoop(ctx context.Context) {
|
||||
|
||||
defer func() {
|
||||
for _, conn := range entireConns {
|
||||
ws.Call(conn.sender, ClientDisconnected, nil)
|
||||
ws.ClientDisconnected(conn)
|
||||
conn.Close()
|
||||
}
|
||||
}()
|
||||
@ -459,11 +459,9 @@ func (ws *WebsocketHandler) mainLoop(ctx context.Context) {
|
||||
case c := <-ws.connInOutChan:
|
||||
if c.Conn == nil {
|
||||
delete(entireConns, c.sender.Accid.Hex())
|
||||
logger.Println("ClientDisconnected :", c.sender.Alias)
|
||||
go ws.ClientDisconnected(c)
|
||||
} else {
|
||||
entireConns[c.sender.Accid.Hex()] = c
|
||||
logger.Println("ClientConnected :", c.sender.Alias)
|
||||
go ws.ClientConnected(c)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user