Skip to content

Commit c1c6dae

Browse files
committed
Assign calculated period start to cl.Period
- Calculate period start based on the current time in milliseconds, rounded to the nearest hour.
1 parent df9ccf1 commit c1c6dae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/schema/v1/container.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ func (cl *ContainerLog) syncContainerLogs(ctx context.Context, clientset *kubern
125125
}
126126

127127
cl.LastUpdate = types.UnixMilli(time.Now())
128+
// Calculate period
129+
currentTimeMillis := time.Now().UnixMilli()
130+
periodStartMillis := currentTimeMillis - (currentTimeMillis % (3600 * 1000))
131+
cl.Period = types.UnixMilli(time.UnixMilli(periodStartMillis))
128132
cl.Logs += string(logs)
129133
entities := make(chan interface{}, 1)
130134
entities <- cl

0 commit comments

Comments
 (0)