Skip to content

Commit

Permalink
fix(be): remove recursive call in BoltDB method
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Jan 29, 2022
1 parent db25237 commit 8516e31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db/bolt/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ func (d *BoltDb) getTasks(projectID int, templateID *int, params db.RetrieveQuer
tpl, ok := templates[task.TemplateID]
if !ok {
if templateID == nil {
tpl, _ = d.GetTemplate(task.ProjectID, task.TemplateID)
tpl, _ = d.getRawTemplate(task.ProjectID, task.TemplateID)
} else {
tpl, _ = d.GetTemplate(task.ProjectID, *templateID)
tpl, _ = d.getRawTemplate(task.ProjectID, *templateID)
}
templates[task.TemplateID] = tpl
}
Expand Down
7 changes: 6 additions & 1 deletion db/bolt/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ func (d *BoltDb) GetTemplates(projectID int, filter db.TemplateFilter, params db
return
}

func (d *BoltDb) GetTemplate(projectID int, templateID int) (template db.Template, err error) {
func (d *BoltDb) getRawTemplate(projectID int, templateID int) (template db.Template, err error) {
err = d.getObject(projectID, db.TemplateProps, intObjectID(templateID), &template)
return
}

func (d *BoltDb) GetTemplate(projectID int, templateID int) (template db.Template, err error) {
template, err = d.getRawTemplate(projectID, templateID)
if err != nil {
return
}
Expand Down

0 comments on commit 8516e31

Please sign in to comment.