'Called when a task is done and success, called by `on_task_status`'

def on_task_done(self, task):

    task['status'] = self.taskdb.SUCCESS
    task['lastcrawltime'] = time.time()
    if ('schedule' in task):
        if (task['schedule'].get('auto_recrawl') and ('age' in task['schedule'])):
            task['status'] = self.taskdb.ACTIVE
            next_exetime = task['schedule'].get('age')
            task['schedule']['exetime'] = (time.time() + next_exetime)
            self.put_task(task)
        else:
            del task['schedule']
    self.update_task(task)
    project = task['project']
    self._cnt['5m'].event((project, 'success'), (+ 1))
    self._cnt['1h'].event((project, 'success'), (+ 1))
    self._cnt['1d'].event((project, 'success'), (+ 1))
    self._cnt['all'].event((project, 'success'), (+ 1)).event((project, 'pending'), (-1))
    logger.info('task    done    %(project)s:%(taskid)s    %(url)s', task)
    return task
