My feeds importer is acting very strange and running the same import multiple times..
This is what my importer looks like:
class FeedsASUNewCareer extends FeedsCSVParser {
/**
* Implements FeedsParser::parse().
*/
public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) {
global $user;
$source_config = $source->getConfigFor($this);
$state = $source->state(FEEDS_PARSE);
// Load and configure parser.
feeds_include_library('ParserCSV.inc', 'ParserCSV');
$parser = new ParserCSV();
$delimiter = $source_config['delimiter'] == 'TAB' ? "\t" : $source_config['delimiter'];
$parser->setDelimiter($delimiter);
$iterator = new ParserCSVIterator($fetcher_result->getFilePath());
if (empty($source_config['no_headers'])) {
// Get first line and use it for column names, convert them to lower case.
$header = $this->parseHeader($parser, $iterator);
if (!$header) {
watchdog('CAREER IMPORT ERROR', "Could not parse header");
return;
}
$parser->setColumnNames($header);
}
// Determine section to parse, parse.
$start = $state->pointer ? $state->pointer : $parser->lastLinePos();
$limit = $source->importer->getLimit();
$rows = $this->parseItems($parser, $iterator, $start, $limit);
// Report progress.
$state->total = filesize($fetcher_result->getFilePath());
$state->pointer = $parser->lastLinePos();
$progress = $parser->lastLinePos() ? $parser->lastLinePos() : $state->total;
$state->progress($state->total, $progress);
$careers = array();
watchdog('careers', '<pre>' . print_r($rows, TRUE) . '</pre>');
foreach($rows as $career) {
// create career.
$node = entity_create('node', array('type' => 'careers'));
$entity = entity_metadata_wrapper('node',$node);
// Set Entity properties
$entity->title->set($career['alternate_title']);
$entity->language = 'en';
$entity->author = $user->uid;
$entity->status = $career['status'];
$entity->body->set(array('value' => $career['body']));
$entity->field_alternate_title->set($career['alternate_title']);
$entity->field_career_category_image->set($career['car_category_img']);
$entity->field_careercategory->set($setCategoryId);
// Save Career
$entity->save(); //Save new Entity wrapper
$node->tnid = $node->nid;
$entity->save();
}
}
// return empty set.
$ret = new FeedsParserResult();
return $ret;
}
}
When I go to Content > Import
and select this Feed Importer to use, it just gets hung up on the processing page and in my logs I can see my watchdog watchdog('careers', '<pre>' . print_r($rows, TRUE) . '</pre>');
executes over and over until I stop it. Keep in mind that watchdog is not in a loop, so the feeds importer is just running endlessly until I stop it.
What could cause the importer to act with such behavior?