From 0780b6b2ca8a9450c5e8038f889460ee45b6a039 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 22 Nov 2007 17:46:29 +0000 Subject: Abort get_cache early if url is invalid (e.g. 404), better error message --- it_url.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'it_url.class') diff --git a/it_url.class b/it_url.class index cb0f0c9..127bd01 100644 --- a/it_url.class +++ b/it_url.class @@ -464,16 +464,16 @@ function _waitforpath($p) $p += array('sleeptime' => 0.1); # seconds to wait per pass # wait until cache is ready, then read from cache - for ($maxpasses = $p['timeout'] / $p['sleeptime'], $passes = 0; (@filesize($p['path']) <= 0) && ($passes < $maxpasses); ++$passes) + for ($maxpasses = $p['timeout'] / $p['sleeptime'], $passes = 0; (($size = @filesize($p['path'])) === 0) && ($passes < $maxpasses); ++$passes) { usleep($p['sleeptime'] * 1000000); clearstatcache(); } - if ($passes < $maxpasses) + if ($size) $result = $p['path']; else if ($p['safety'] == 1) - it::error("timeout in it_url::get_cache(): url={$p['url']}, passes=$passes, maxpasses=$maxpasses, path={$p['path']}"); + it::error(($passes < $maxpasses ? "error getting url" : "timeout") . " in it_url::get_cache(): url={$p['url']}, passes=$passes, maxpasses=$maxpasses, path={$p['path']}"); return $result; } -- cgit v1.2.3