Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cobolbaby opened this issue Mar 28, 2023 · 1 comment
Open

Comments

@cobolbaby
Copy link
Contributor

cobolbaby commented Mar 28, 2023

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
}
}
}

@vcastellm
Copy link
Member

This can be an improvement, not very critical though because only 100 executions are going to be stored for each job.

We're missing a GetExecution method in Storage interface and that's it.

Feel free to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants