Skip to content

Comments

98 feature optimize content add endpoints#103

Open
LucRoy wants to merge 2 commits intomainfrom
98-feature-optimize-content-add-endpoints
Open

98 feature optimize content add endpoints#103
LucRoy wants to merge 2 commits intomainfrom
98-feature-optimize-content-add-endpoints

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
}

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