mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 21:26:02 +08:00
use ticker for polling db in live tail.
This commit is contained in:
parent
7b6a086b37
commit
047227ad18
@ -2907,6 +2907,8 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailC
|
|||||||
idStart = client.Filter.IdStart
|
idStart = client.Filter.IdStart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ticker := time.NewTicker(time.Duration(r.liveTailRefreshSeconds) * time.Second)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -2914,7 +2916,7 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailC
|
|||||||
client.Done <- &done
|
client.Done <- &done
|
||||||
zap.S().Debug("closing go routine : " + client.Name)
|
zap.S().Debug("closing go routine : " + client.Name)
|
||||||
return
|
return
|
||||||
default:
|
case <-ticker.C:
|
||||||
// get the new 100 logs as anything more older won't make sense
|
// get the new 100 logs as anything more older won't make sense
|
||||||
tmpQuery := fmt.Sprintf("%s where timestamp >='%d'", query, tsStart)
|
tmpQuery := fmt.Sprintf("%s where timestamp >='%d'", query, tsStart)
|
||||||
if filterSql != "" {
|
if filterSql != "" {
|
||||||
@ -2947,7 +2949,6 @@ func (r *ClickHouseReader) TailLogs(ctx context.Context, client *model.LogsTailC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time.Sleep(time.Duration(r.liveTailRefreshSeconds) * time.Second)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user