Skip to content

Performance issue with the /:job/executions/:execution API interface #1308

@cobolbaby

Description

@cobolbaby

Is your feature request related to a problem? Please describe.

The current implementation is to obtain all Execution records first, and then filter according to the Execution name.
Why not get it directly through fmt.Sprintf("%s:%s:%s", executionsPrefix, execution.JobName, execution.Key())?

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

dkron/dkron/api.go

Lines 387 to 416 in 53864a0

func (h *HTTPTransport) executionHandler(c *gin.Context) {
jobName := c.Param("job")
executionName := c.Param("execution")
job, err := h.agent.Store.GetJob(jobName, nil)
if err != nil {
c.AbortWithError(http.StatusNotFound, err)
return
}
executions, err := h.agent.Store.GetExecutions(job.Name,
&ExecutionOptions{
Sort: "",
Order: "",
Timezone: job.GetTimeLocation(),
},
)
if err != nil {
h.logger.Error(err)
return
}
for _, execution := range executions {
if execution.Id == executionName {
renderJSON(c, http.StatusOK, execution)
return
}
}
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions