Ask Your Question
1

Caching problems on main page

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

zaf gravatar image zaf
554 8 8 26

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?

delete close flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
2

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

Evgeny gravatar image Evgeny flag of Chile
11009 50 84 182
http://askbot.org/

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.

link publish delete flag offensive edit
1

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

zaf gravatar image zaf
554 8 8 26

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

link publish delete flag offensive edit

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 ( 2012-05-12 13:50:13 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

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

Seen: 103 times

Last updated: May 12 '12