the inefficiency in #538

springrider opened this Issue Sep 21, 2012 · 1 comment


None yet
2 participants

in the comment_tree module, while doing link_comments(link_id, _update=False). it will query the cache first, it the item not exist, it will query db and save the results to cache.
this involved db query, and also db update(num_comments).

while a link has no comment, it certainly will go into the db things, which is a waste of time. since all of the comments already in cassandra, there seems no need to load it from db in normal case. so why not just return empty result when there is no comments?

I have changed the code related to 'r' checking as below, now sure if it is okay:

if not r:
     r = ([],{},{},{})
if not _update:  #avoid db query
    return r

spladug commented Feb 14, 2014

I believe this was fixed in 879f6c4. Additionally, as we migrate to CommentTree v2.1 it should become less of a concern.

spladug closed this Feb 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment