Enable periodic cleaning of mqueue
This commit is contained in:
parent
b82615a974
commit
ea673b809c
@ -125,7 +125,7 @@ var (
|
|||||||
File os.File
|
File os.File
|
||||||
Writer *bufio.Writer
|
Writer *bufio.Writer
|
||||||
|
|
||||||
Version = "0.6.7"
|
Version = "0.6.8"
|
||||||
|
|
||||||
BuildInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
BuildInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
||||||
Name: "openldaplogparser_build_info",
|
Name: "openldaplogparser_build_info",
|
||||||
@ -322,7 +322,7 @@ func writeOut(msg string, filename string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Every 24H, remove connections closed more than 24 hours ago
|
// Every 24H, remove connections closed more than 24 hours ago
|
||||||
func periodicallyCleanMQueue(mqueue map[int]*OpenLdapConnection, mqMtx *sync.Mutex) {
|
func periodicallyCleanMQueue(mqueue map[string]*OpenLdapConnection, mqMtx *sync.Mutex) {
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
for range time.Tick(time.Hour * 24) {
|
for range time.Tick(time.Hour * 24) {
|
||||||
@ -339,7 +339,8 @@ func periodicallyCleanMQueue(mqueue map[int]*OpenLdapConnection, mqMtx *sync.Mut
|
|||||||
}
|
}
|
||||||
if ok == true {
|
if ok == true {
|
||||||
mqMtx.Lock()
|
mqMtx.Lock()
|
||||||
delete(mqueue, ldcon.ConnId)
|
//delete(mqueue, ldcon.ConnId)
|
||||||
|
delete(mqueue, fmt.Sprintf("%s:%d", ldcon.Hostname, ldcon.ConnId))
|
||||||
mqMtx.Unlock()
|
mqMtx.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -970,7 +971,7 @@ func processLogs(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cleaner thread
|
// Cleaner thread
|
||||||
//go periodicallyCleanMQueue(mQueue, &mqMtx)
|
go periodicallyCleanMQueue(mQueue, &mqMtx)
|
||||||
|
|
||||||
// Initialize Stdin input...
|
// Initialize Stdin input...
|
||||||
if true == strings.EqualFold(gSyslogListenAddress, "do-not-listen") {
|
if true == strings.EqualFold(gSyslogListenAddress, "do-not-listen") {
|
||||||
|
Loading…
Reference in New Issue
Block a user