public function finish($id, $res = ''){
    if ( ($article = $this->get_article($id)) &&
            ($cron = $this->get_cron($article['id_cron'])) ){
      bbn\appui\history::disable();
      $time = $this->timer->has_started('cron_'.$article['id_cron']) ? $this->timer->stop('cron_'.$article['id_cron']): 0;
      if ( !empty($res) ){
        bbn\x::hdump($id, $res);
        $this->db->update($this->jtable, [
          'finish' => date('Y-m-d H:i:s'),
          'duration' => $time,
          'res' => $res
        ], [
          'id' => $id
        ]);
      }
      else{
        $this->db->delete($this->jtable, ['id' => $id]);
        $prev = $this->db->rselect($this->jtable, ['res', 'id'], ['id_cron' => $article['id_cron']], ['finish' => 'DESC']);
        if ( $prev['res'] === 'error' ){
          $this->db->update($this->jtable, ['res' => 'Restarted after error'], ['id' => $prev['id']]);
        }
      }
      bbn\appui\history::enable();
      return $time;
    }
    return false;
  }