From 8516e31415fa7d339e043337fd3592069df9b9a6 Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Sat, 29 Jan 2022 14:14:42 +0500 Subject: [PATCH] fix(be): remove recursive call in BoltDB method --- db/bolt/task.go | 4 ++-- db/bolt/template.go | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/db/bolt/task.go b/db/bolt/task.go index 288fb408..4c98f7a9 100644 --- a/db/bolt/task.go +++ b/db/bolt/task.go @@ -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 } diff --git a/db/bolt/template.go b/db/bolt/template.go index 6a3f34d5..c4b739a6 100644 --- a/db/bolt/template.go +++ b/db/bolt/template.go @@ -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 }