From b7c0e7223f007546d1c2632147072bb8627efa90 Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Mon, 6 Dec 2010 20:35:06 +0000 Subject: [PATCH] Log time consumed by import. --- includes/FeedsSource.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index 729cbacc..90f8e3ca 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -14,6 +14,7 @@ class FeedsLockException extends Exception {} /** * Denote a import or clearing stage. Used for multi page processing. */ +define('FEEDS_START', 'start_time'); define('FEEDS_FETCH', 'fetch'); define('FEEDS_PARSE', 'parse'); define('FEEDS_PROCESS', 'process'); @@ -329,6 +330,11 @@ class FeedsSource extends FeedsConfigurable { public function import() { $this->acquireLock(); try { + // If fetcher result is empty, we are starting a new import, log. + if (empty($this->fetcher_result)) { + $this->state[FEEDS_START] = time(); + } + // Fetch. if (empty($this->fetcher_result) || FEEDS_BATCH_COMPLETE == $this->progressParsing()) { $this->fetcher_result = $this->importer->fetcher->fetch($this); @@ -350,7 +356,8 @@ class FeedsSource extends FeedsConfigurable { $result = $this->progressImporting(); if ($result == FEEDS_BATCH_COMPLETE || isset($e)) { 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); } $this->save(); -- GitLab