mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 08:49:53 -06:00
Fix: Events query performance improvements (#1930)
* fix: split up event queries for perf * fix: refs * fix: event join
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hatchet-dev/hatchet/api/v1/server/oas/gen"
|
||||
"github.com/hatchet-dev/hatchet/pkg/repository/v1/sqlcv1"
|
||||
v1 "github.com/hatchet-dev/hatchet/pkg/repository/v1"
|
||||
)
|
||||
|
||||
func parseTriggeredRuns(triggeredRuns []byte) ([]gen.V1EventTriggeredRun, error) {
|
||||
@@ -49,7 +49,7 @@ func parseTriggeredRuns(triggeredRuns []byte) ([]gen.V1EventTriggeredRun, error)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func ToV1EventList(events []*sqlcv1.ListEventsRow, limit, offset, total int64) gen.V1EventList {
|
||||
func ToV1EventList(events []*v1.ListEventsRow, limit, offset, total int64) gen.V1EventList {
|
||||
rows := make([]gen.V1Event, len(events))
|
||||
|
||||
numPages := int64(math.Ceil(float64(total) / float64(limit)))
|
||||
@@ -86,15 +86,15 @@ func ToV1EventList(events []*sqlcv1.ListEventsRow, limit, offset, total int64) g
|
||||
Id: row.EventExternalID.String(),
|
||||
},
|
||||
WorkflowRunSummary: gen.V1EventWorkflowRunSummary{
|
||||
Cancelled: row.CancelledCount.Int64,
|
||||
Succeeded: row.CompletedCount.Int64,
|
||||
Queued: row.QueuedCount.Int64,
|
||||
Failed: row.FailedCount.Int64,
|
||||
Running: row.RunningCount.Int64,
|
||||
Cancelled: row.CancelledCount,
|
||||
Succeeded: row.CompletedCount,
|
||||
Queued: row.QueuedCount,
|
||||
Failed: row.FailedCount,
|
||||
Running: row.RunningCount,
|
||||
},
|
||||
Payload: &payload,
|
||||
SeenAt: &row.EventSeenAt.Time,
|
||||
Scope: &row.EventScope.String,
|
||||
Scope: &row.EventScope,
|
||||
TriggeredRuns: &triggeredRuns,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user