Skip to content
Snippets Groups Projects
Commit b7c0e722 authored by Alex Barth's avatar Alex Barth
Browse files

Log time consumed by import.

parent c55df077
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ class FeedsLockException extends Exception {} ...@@ -14,6 +14,7 @@ class FeedsLockException extends Exception {}
/** /**
* Denote a import or clearing stage. Used for multi page processing. * Denote a import or clearing stage. Used for multi page processing.
*/ */
define('FEEDS_START', 'start_time');
define('FEEDS_FETCH', 'fetch'); define('FEEDS_FETCH', 'fetch');
define('FEEDS_PARSE', 'parse'); define('FEEDS_PARSE', 'parse');
define('FEEDS_PROCESS', 'process'); define('FEEDS_PROCESS', 'process');
...@@ -329,6 +330,11 @@ class FeedsSource extends FeedsConfigurable { ...@@ -329,6 +330,11 @@ class FeedsSource extends FeedsConfigurable {
public function import() { public function import() {
$this->acquireLock(); $this->acquireLock();
try { try {
// If fetcher result is empty, we are starting a new import, log.
if (empty($this->fetcher_result)) {
$this->state[FEEDS_START] = time();
}
// Fetch. // Fetch.
if (empty($this->fetcher_result) || FEEDS_BATCH_COMPLETE == $this->progressParsing()) { if (empty($this->fetcher_result) || FEEDS_BATCH_COMPLETE == $this->progressParsing()) {
$this->fetcher_result = $this->importer->fetcher->fetch($this); $this->fetcher_result = $this->importer->fetcher->fetch($this);
...@@ -350,7 +356,8 @@ class FeedsSource extends FeedsConfigurable { ...@@ -350,7 +356,8 @@ class FeedsSource extends FeedsConfigurable {
$result = $this->progressImporting(); $result = $this->progressImporting();
if ($result == FEEDS_BATCH_COMPLETE || isset($e)) { if ($result == FEEDS_BATCH_COMPLETE || isset($e)) {
module_invoke_all('feeds_after_import', $this); module_invoke_all('feeds_after_import', $this);
$this->imported = REQUEST_TIME; $this->imported = time();
$this->log('import', 'Imported in !s s', array('!s' => $this->imported - $this->state[FEEDS_START]), WATCHDOG_INFO);
unset($this->fetcher_result, $this->state); unset($this->fetcher_result, $this->state);
} }
$this->save(); $this->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment