summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian Schneider2007-11-22 17:46:29 +0000
committerChristian Schneider2007-11-22 17:46:29 +0000
commit0780b6b2ca8a9450c5e8038f889460ee45b6a039 (patch)
treef6e8915e4ac7916a7cf7186be04fee95a76ef242 /it_url.class
parentf8edb35a64b3be3c2a670e1b2248b50926bd2de7 (diff)
downloaditools-0780b6b2ca8a9450c5e8038f889460ee45b6a039.tar.gz
itools-0780b6b2ca8a9450c5e8038f889460ee45b6a039.tar.bz2
itools-0780b6b2ca8a9450c5e8038f889460ee45b6a039.zip
Abort get_cache early if url is invalid (e.g. 404), better error message
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class6
1 files changed, 3 insertions, 3 deletions
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;
}