custom function to delete determined content type's nodes never finish I am trying to make a custom module which delete all nodes of a content type and then import new nodes of this type from a .txt (maybe I will use feeds import for this). 

In the first step of my module, I had found this code to delete nodes: 

function nodes_import_delete() {
  // Gather all the pivot content that might have been created while this
  // module was enabled.  Simple selects still use db_query().
  // http://api.drupal.org/api/function/db_query/7
  $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
  $result = db_query($sql, array(':type' =&gt; 'apunte'));
  $nids = array();
  foreach ($result as $row) {
    $nids[] = $row-&gt;nid;
  }

  // Delete all the nodes at once
  // http://api.drupal.org/api/function/node_delete_multiple/7
  node_delete_multiple($nids);
}


My problem is this function never finish when is executed and I don't know why.

apunte is my content type which I want to delete all nodes.
May be the server execution is taking long time to delete nodes.Try to increase your server execution time or change the code to batch process or pass limited nids to the  delete function.