Exemplo n.º 1
0
def add_comment(comment, user, channel_id, video_id, parent_id):
    if not user or not channel_id or not video_id:
        return None
    video = _video_key(channel_id, video_id)
    comment = CommentModel(
        parent=video, comment=comment, user=user, channel_id=channel_id, video_id=video_id, parent_id=int(parent_id)
    )
    comment.put()
    fastcounter.incr(video_comment_counter(channel_id, video_id))
    return comment
Exemplo n.º 2
0
     def timed(*args, **kw):
         if not configs.BENCHMARK:
             return fn(*args, **kw)
         
         start = time.time()
         result = fn(*args, **kw)
         end = time.time()
         
         fastcounter.incr("Function_%s_NumCalls" % name, 1, 3600)
         fastcounter.incr("Function_%s_TotalMicroSeconds" % name,
                           int((end - start) * 1000000 + 0.5), 3600)
 
         return result
Exemplo n.º 3
0
def dislike_video(key, channel_id, video_id, delta=1):
    history = video_dislike_history_counter(key, channel_id, video_id)
    if fastcounter.get_count(history) > 0:
        return
    fastcounter.incr(history)
    fastcounter.incr(video_dislike_counter(channel_id, video_id), delta)
Exemplo n.º 4
0
def view_video(channel_id, video_id):
    fastcounter.incr(video_view_counter(channel_id, video_id))
Exemplo n.º 5
0
def like_comment(channel_id, video_id, comment_id, delta=1):
    fastcounter.incr(comment_like_counter(channel_id, video_id, comment_id))