Skip to content

Commit

Permalink
fix sync batch graph
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 4, 2024
1 parent 45d3201 commit 616d5e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flow/cmd/mirror_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,13 @@ func (h *FlowRequestHandler) cdcFlowStatus(

func (h *FlowRequestHandler) CDCGraph(ctx context.Context, req *protos.GraphRequest) (*protos.GraphResponse, error) {
truncField := "minute"
if slices.Contains([]string{"hour", "day", "month"}, req.AggregateType) {
truncField = req.AggregateType
switch req.AggregateType {
case "1hour":
truncField = "hour"
case "1day":
truncField = "day"
case "1month":
truncField = "month"
}
rows, err := h.pool.Query(ctx, `select tm, coalesce(sum(rows_in_batch), 0)
from generate_series(date_trunc($2, now() - $1::INTERVAL * 30), now(), $1::INTERVAL) tm
Expand Down

0 comments on commit 616d5e2

Please sign in to comment.