custom function to delete determined content type's nodes never finish
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.