title: Drupal 6 - Captcha 6.24 - Cron fails to truncate captcha_sessions table
body: <p>Environment:</p>
  
  <p>Drupal 6
  Captcha 6.24</p>
  
  <p><strong>Problem</strong></p>
  
  <p>Today the module started giving problems. The first clue as to what was happening was through <strong>Reports > Recent log entries</strong> . It was plagued with the following:</p>
  
  <pre><code>Duplicate entry ***** for key ******  query: 
  INSERT into captcha_sessions (uid, sid, ip_address, timestamp, 
  form_id, solution, status, attempts) VALUES (....) 
  </code></pre>
  
  <p>As expected, the table was HUGE, I'm talking over 25mbs. I was under the impression that Drupal´s cron was in charge of deleting the data in this table (as well as logs) when it ran. Since it's Drupal 6 I went over to <strong>poormanscron</strong> and had it run....but nothing changed.</p>
  
  <p>My temporary solution was to truncate, manually, said table. But it bugs me that Drupal´s cron is not doing so on its own. So, I'm left wondering, is my only chance to keep this table at low size with a custom script server side? </p>
  
  <p>Is there something I need to set so that Drupal's cron deletes logs and clears that table? Since it's Drupal 6 I'm a listtle lost, because in Drupal 7 I could just create a cron job.</p>
  
  <p>Thank in advance.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>This function is found in the <code>captcha.module</code> file. But it's not doing as it says, the table never gets truncated.</p>
  
  <pre><code>function catpcha_cron{
     db_query('DELETE FROM {captcha_sessions} WHERE timestamp &lt; %d', time() - 60*60*24);
  }
  </code></pre>