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

98 feature optimize content add endpoints #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LucRoy
Copy link
Contributor

@LucRoy LucRoy commented Jul 24, 2023

  • Changed /content endpoints to use gorm transaction.
  • Pulled all datasets into a single query before looping through all content to be added.

@LucRoy LucRoy requested a review from jcace July 24, 2023 13:02
@LucRoy LucRoy self-assigned this Jul 24, 2023
@LucRoy LucRoy linked an issue Jul 24, 2023 that may be closed by this pull request
@@ -148,47 +153,56 @@ func ConfigureContentsRouter(e *echo.Group, dldm *core.DeltaDM) {
return err
}

cache := make(map[string]uint)
if err := dldm.DB.Model(&db.Dataset{}).Find(&datasets).Error; err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, doesn't this .Find() only work on the primary key i.e, dataset ID ? We need to search via name instead here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm here we are listing all datasets instead of querying per name. Let me know if you have a more efficient way of doing it.

@jcace
Copy link
Contributor

jcace commented Jul 25, 2023

@LucRoy Looks good, will test as soon as you fix that one query!

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

Successfully merging this pull request may close these issues.

[Feature] Optimize /content add endpoints
2 participants