First time here? Check out the FAQ!
1

Caching problems on main page

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?

zaf's avatar
512
zaf
asked 2012-05-11 19:30:30 -0500, updated 2012-05-11 19:32:14 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

2

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.

Evgeny's avatar
13.2k
Evgeny
answered 2012-05-11 20:24:29 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
1

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/question.py 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.

zaf's avatar
512
zaf
answered 2012-05-12 06:11:36 -0500, updated 2012-05-12 06:15:16 -0500
edit flag offensive 0 remove flag delete link

Comments

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's avatar Evgeny (2012-05-12 13:50:13 -0500) edit
add a comment see more comments