#2040 - curl errors on upload to hub - fixes and upload parameters changes

This commit is contained in:
tomash 2006-11-30 03:38:02 +00:00
parent 6c751954ee
commit 657d7c2ab5
2 changed files with 24 additions and 11 deletions

View File

@ -1422,8 +1422,14 @@ class BasicStor extends Alib {
if (!file_exists($metadata)) {
$metadata = NULL;
}
$r = $this->bsExistsFile($gunid, NULL, TRUE);
if (!PEAR::isError($res) && !$r) {
$exists = $this->bsExistsFile($gunid, NULL, TRUE);
if( $exists ) {
$res = $this->idFromGunid($gunid);
if (!PEAR::isError($res)) {
$res = $this->bsDeleteFile($res, TRUE);
}
}
if (!PEAR::isError($res) ) {
$res = $this->bsPutFile($parid, $gunid, $rawMedia, $metadata,
$gunid, 'audioclip'
);

View File

@ -83,10 +83,10 @@ class Transport
private $cronJobScript;
/**
* wget --timeout parameter [s]
* wget --read-timeout parameter [s]
* @var int
*/
private $downTimeout = 20; // 600
private $downTimeout = 900;
/**
* wget --waitretry parameter [s]
@ -109,19 +109,19 @@ class Transport
* curl --max-time parameter
* @var int
*/
private $upTrMaxTime = 600;
private $upTrMaxTime = 1800;
/**
* curl --speed-time parameter
* @var int
*/
private $upTrSpeedTime = 20;
private $upTrSpeedTime = 30;
/**
* curl --speed-limit parameter
* @var int
*/
private $upTrSpeedLimit = 500;
private $upTrSpeedLimit = 30;
/**
* curl --connect-timeout parameter
@ -195,6 +195,13 @@ class Transport
$res['realsize'] = filesize($trec->row['localfile']);
$res['realsum'] = $this->_chsum($trec->row['localfile']);
}
if ( ($trec->row['direction'] == 'up') ){
$check = $this->uploadCheck($trec->row['pdtoken']);
if (!PEAR::isError($check)) {
$res['realsize'] = $check['size'];
$res['realsum'] = $check['realsum'];
}
}
// do not return finished on finished search job upload
// - whole search is NOT finished
if ($res['trtype'] == "searchjob" && $res['direction'] == "up" && $res['state'] == "finished") {
@ -1110,9 +1117,9 @@ class Transport
}
$res = system($command, $status);
// status 18 - Partial file. Only a part of the file was transported.
if ($status == 0 || $status == 18) {
// status 28 - timeout
// if ($status == 0 || $status == 18 || $status == 28) {
// status 28 - Timeout. Too long/slow upload, try to resume next time rather.
// if ($status == 0 || $status == 18) {
if ($status == 0 || $status == 18 || $status == 28) {
$check = $this->uploadCheck($row['pdtoken']);
if (PEAR::isError($check)) {
return $check;
@ -1174,7 +1181,7 @@ class Transport
$url = escapeshellarg($row['url']);
$command =
"wget -q -c".
" --timeout={$this->downTimeout}".
" --read-timeout={$this->downTimeout}".
" --waitretry={$this->downWaitretry}".
" -t {$this->downRetries}".
(!is_null($this->downLimitRate)?