Beispiel #1
0
 def run(self):
     if not redis_write_client:
         return
     while True:
         avatar_id = redis_suggestions.next_scheduled_check()
         if avatar_id is None:
             break
         avatar = AvatarHolder().getById(avatar_id)
         if avatar:
             self._update_suggestions(avatar)
         redis_suggestions.unschedule_check(avatar_id)
Beispiel #2
0
 def run(self):
     if not redis_write_client:
         return
     while True:
         avatar_id = redis_suggestions.next_scheduled_check()
         if avatar_id is None:
             break
         avatar = AvatarHolder().getById(avatar_id)
         if avatar:
             self._update_suggestions(avatar)
         redis_suggestions.unschedule_check(avatar_id)
Beispiel #3
0
def category_suggestions():
    if not redis_write_client:
        return
    while True:
        user_id = next_scheduled_check()
        if user_id is None:
            break
        user = User.get(int(user_id))
        if user:
            for category, score in get_category_scores(user).iteritems():
                if score < SUGGESTION_MIN_SCORE:
                    continue
                logger.debug('Suggesting {} with score {:.03} for {}'.format(category, score, user))
                suggest(user, 'category', category.getId(), score)
        unschedule_check(user_id)
Beispiel #4
0
def category_suggestions():
    if not redis_write_client:
        return
    while True:
        user_id = next_scheduled_check()
        if user_id is None:
            break
        user = User.get(int(user_id))
        if user:
            for category, score in get_category_scores(user).iteritems():
                if score < SUGGESTION_MIN_SCORE:
                    continue
                logger.debug('Suggesting %s with score %.03f for %s', category, score, user)
                suggest(user, 'category', category.getId(), score)
        unschedule_check(user_id)