-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SUP-20262: increase process timeout to 20 min for entries > 2GB #9131
Changes from all commits
a4c1fdb
4aae198
3c4d56d
eef16e3
acbe77a
a88ac53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,9 @@ class YoutubeApiDistributionEngine extends DistributionEngine implements | |
{ | ||
protected $tempXmlPath; | ||
protected $timeout = 90; | ||
protected $processedTimeout = 300; | ||
protected $processedTimeout = 300; | ||
protected $longProcessedTimeout = 1200; | ||
protected $bigFile = 2147483648; | ||
Comment on lines
+33
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MosheMaorKaltura default values |
||
|
||
/* (non-PHPdoc) | ||
* @see DistributionEngine::configure() | ||
|
@@ -261,10 +263,13 @@ protected function doSubmit(KalturaDistributionSubmitJobData $data, KalturaYoutu | |
$client->setDefer(true); | ||
$request = $youtube->videos->insert("status,snippet", $video); | ||
|
||
$fileSize = kFile::fileSize($videoPath); | ||
|
||
$media = new Google_Http_MediaFileUpload($client, $request, 'video/*', null, true, self::DEFAULT_CHUNK_SIZE_BYTE); | ||
$media->setFileSize(filesize($videoPath)); | ||
$media->setFileSize($fileSize); | ||
$ingestedVideo = self::uploadInChunks($media,$videoPath, self::DEFAULT_CHUNK_SIZE_BYTE); | ||
$client->setDefer(false); | ||
$this->setLongProcessedTimeout($fileSize); | ||
|
||
$data->remoteId = $ingestedVideo->getId(); | ||
|
||
|
@@ -682,5 +687,29 @@ private static function uploadChunk($media, $chunk) | |
|
||
} | ||
|
||
/** | ||
* @param int $fileSize | ||
*/ | ||
protected function setLongProcessedTimeout($fileSize) | ||
{ | ||
if (isset(KBatchBase::$taskConfig->params->youtubeApi)) | ||
{ | ||
if (isset(KBatchBase::$taskConfig->params->youtubeApi->longProcessedTimeout)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use {} for every if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
{ | ||
$this->longProcessedTimeout = KBatchBase::$taskConfig->params->youtubeApi->longProcessedTimeout; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If value is not set in the configuration file - supply default value hard coded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. default values set lines 33-35 |
||
} | ||
|
||
if (isset(KBatchBase::$taskConfig->params->youtubeApi->bigFile)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here - if no value , then set default hard coded. |
||
{ | ||
$this->bigFile = KBatchBase::$taskConfig->params->youtubeApi->bigFile; | ||
} | ||
} | ||
|
||
if ($fileSize > $this->bigFile) | ||
{ | ||
$this->processedTimeout = $this->longProcessedTimeout; | ||
KalturaLog::info('Increased processed timeout to '.$this->processedTimeout.' seconds for file larger than ' . $this->bigFile); | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to use this default values if they are not set in configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set both properties on the class, then we either override them from config (if config exist) otherwise we keep the default values defined on class.
protected $processedTimeout = 300;
protected $longProcessedTimeout = 1200;
Let me know if I confused it.