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

Optimizations #241

Merged
merged 28 commits into from
May 2, 2017
Merged

Optimizations #241

merged 28 commits into from
May 2, 2017

Conversation

jayoshih
Copy link
Contributor

@jayoshih jayoshih commented Apr 27, 2017

Improves loading by 5x

Need to merge #238, #239, and #240 first

Includes following optimizations:

  • Only calculate file size on non-topics
  • Cached original_channel values and associated presets
  • Index database by original source node ids
  • Only load fields that are needed for operations (removed unused serializer fields)
  • Retain values retrieved by get_all_fetch to avoid fetching again
  • Return models rather than ids on duplicate nodes endpoint

…tion into serializers

# Conflicts:
#	contentcuration/contentcuration/models.py
#	contentcuration/contentcuration/serializers.py
#	contentcuration/contentcuration/static/js/edit_channel/import/hbtemplates/import_list_item.handlebars
#	contentcuration/contentcuration/urls.py
#	contentcuration/contentcuration/views.py
…into serializers

# Conflicts:
#	contentcuration/contentcuration/views.py
…ation into serializers

# Conflicts:
#	contentcuration/contentcuration/models.py
…curation into serializers

# Conflicts:
#	contentcuration/contentcuration/urls.py
#	contentcuration/contentcuration/view/file_views.py
#	contentcuration/contentcuration/view/node_views.py
@@ -377,29 +378,43 @@ class ContentNode(MPTTModel, models.Model):
objects = TreeManager()

def get_original_node(self):

key = "original_channel_{}".format(self.original_source_node_id or self.pk)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


def get_channel(self):
root = self.get_root()
channel = root.channel_main or root.channel_trash or root.channel_language or root.channel_previous
channel = root.channel_main or root.channel_trash or root.channel_staging or root.channel_previous
if channel:
return channel.first()

This comment was marked as spam.

return original_channel.main_tree.get_descendants().filter(node_id=self.original_source_node_id).first() or self

return self.original_node or self
original_node = original_channel.main_tree.get_descendants().filter(node_id=self.original_source_node_id).first() or self

This comment was marked as spam.


return new_node

def _duplicate_node(node, sort_order=None, parent=None, channel_id=None):

This comment was marked as spam.

This comment was marked as spam.

@jamalex jamalex merged commit 007d25c into learningequality:develop May 2, 2017
@jayoshih jayoshih deleted the serializers branch May 5, 2017 17:11
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.

None yet

2 participants