From be51d7c69c8dc529b3d801d7de317204bf533ef2 Mon Sep 17 00:00:00 2001 From: Shawna Monero <66325812+smonero@users.noreply.github.com> Date: Wed, 26 Jul 2023 17:52:49 -0700 Subject: [PATCH] remove sorting and let fe do it (#2750) --- backend/service/k8s/event.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/backend/service/k8s/event.go b/backend/service/k8s/event.go index b207c01932..d22628b2bd 100644 --- a/backend/service/k8s/event.go +++ b/backend/service/k8s/event.go @@ -2,7 +2,6 @@ package k8s import ( "context" - "sort" "strings" "github.com/iancoleman/strcase" @@ -35,13 +34,6 @@ func (s *svc) ListEvents(ctx context.Context, clientset, cluster, namespace, obj return events, nil } -// For ease of use, we can sort the events in reverse chronological order -func sortEventsByLastTime(events []*k8sapiv1.Event) { - sort.Slice(events, func(i, j int) bool { - return events[i].LastTimestampMillis > events[j].LastTimestampMillis - }) -} - func ProtoForEvent(cluster string, k8sEvent *corev1.Event) *k8sapiv1.Event { clusterName := GetKubeClusterName(k8sEvent) if clusterName == "" { @@ -125,9 +117,6 @@ func (s *svc) ListNamespaceEvents(ctx context.Context, clientset, cluster, names ev := ev events = append(events, ProtoForEvent(cs.Cluster(), &ev)) } - // Sort in reverse chronological order (by LastTimestampMillis), - // this is needed because we might have multiple types of events - sortEventsByLastTime(events) return events, nil }