view counter is no more updated (celery task not executed)

asked 2012-12-03 08:34:17 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

I've set up my own askbot server

jisuanjiwenti

it's based on the master's branch, since some days (without git pull between) my number of view are not updating

And to be honest, being not very confident with django code, I don't know where to beging to debug the code and know from where the problem is coming. If someone can give me even some little hint that would be greatly appreciated.

Edit: I've debugged the code and I've arrived to the conclusion that for some reason in the file askbot/views/readers.py

    tasks.record_question_visit.delay(
        question_post = question_post,
        user_id = request.user.id,
        update_view_count = update_view_count
    )

the method record_question_visit is never called (I've put some debug around and inside this method, so this line is executed, but it seems the task is delayed and never executed

because if I "hack" the code like this

    #TODO MYHACK
    question_post.thread.increase_view_count()
    tasks.record_question_visit.delay(
        question_post = question_post,
        user_id = request.user.id,
        update_view_count = update_view_count
    )

The views are correctly updated

edit retag flag offensive close merge delete

Comments

What is your CELERY_ALWAYS_EAGER setting? Are you running a celery daemon?

Evgeny gravatar imageEvgeny ( 2012-12-07 08:35:31 -0500 )edit

I'm guessing that this may be related: http://askbot.org/en/question/9628/thread-matching-query-does-not-exist-when-posting/#9630 . Please always specify version of askbot, that will make it easier to help.

Evgeny gravatar imageEvgeny ( 2012-12-09 10:36:08 -0500 )edit