Ask Your Question

Caching problems on main page

asked 2012-05-11 19:30:30 -0500

zaf gravatar image

updated 2012-05-11 19:32:14 -0500

Hi all! I am using Askbot 0.7.42 version and I have noticed a bug in main page's data. In every question in the question list, the date/time of the last update does not get refreshed! For example, if I post a question and go to main page I see 0 mins ago and even if I do refresh in 5 minutes, I'll see the same, zero.

image description

I investigated a little, and I saw that even when I change my name, it does not appear in main page question unless I jump into the question and then return to home page again (and not always - sometimes the bug was insisting). Finally, number of views has also same issue.

Of course, as it may be reasonable, when I restart server, everything gets fixed, showing the correct datetime. I tested it both on normal and private browsing in Chrome. It doesn't have to do with the client, I see the same picture from different PCs.

Anyone having similar issues?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-05-11 20:24:29 -0500

Evgeny gravatar image

We are about to solve this by merging the development branches to master.

We've started using .timeago() jQuery plugin to recalculate the displayed timestamp renderings in the browsers.

The main reason for this change is to allow much longer caching of the template fragments. We have also moved personalization-related code from .html templates to javascript on more popular pages - also to improve caching.

edit flag offensive delete link more

answered 2012-05-12 06:11:36 -0500

zaf gravatar image

updated 2012-05-12 06:15:16 -0500

Thanks @Evgeny, looking forward to your solution!

Meanwhile, I tried to have a look into the code, although i'm not familiar with Python at all. I noticed that on /models/ file there is get_summary_html() function calling get_cached_summary_html() and if it doesn't return anything (probably meaning that it didn't find the data it seeks at the cache), it then calls update_summary_html():

def get_summary_html(self, search_state):
    html = self.get_cached_summary_html()
    if not html:
        html = self.update_summary_html()

So, if I comment out the first call and force it to always call update_summary_html(), problem disappears. Of course that's a stupid workaround that doesn't take advantage of the cache, so system may respond slower. But it works and gives the impression to users that everything is fine, so until team gives the perpanent solution, this may fit you.

Last, I notice that in the same file at line 456 of invalidate_cached_data() you have lately commented out the call of invalidate_cached_thread_content_fragment() which deletes stuff from the cache, and I was wondering if that change has anything to do with the problem we discuss here.

edit flag offensive delete link more


Right, disabling cache solves one apparent problem but will slow down the site. For a small site it is not a big issue. The invalidate_cached_data() calls that other function inside. I am working on a release this weekend.

Evgeny gravatar imageEvgeny ( 2012-05-12 13:50:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-05-11 19:30:30 -0500

Seen: 1,426 times

Last updated: May 12 '12