Skip to content

Commit

Permalink
Merge pull request #1357 from craftcms/bugfix/1356-dont-ignore-feed-o…
Browse files Browse the repository at this point in the history
…ptions

don't ignore feed options
  • Loading branch information
angrybrad committed Jul 25, 2023
2 parents d85c719 + 1956e6e commit f6103d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/helpers/AssetHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class AssetHelper
* @param $dstName
* @param int $chunkSize
* @param bool $returnbytes
* @param null|int $feedId
* @return bool|int
*/
public static function downloadFile($srcName, $dstName, $chunkSize = 1, $returnbytes = true)
public static function downloadFile($srcName, $dstName, $chunkSize = 1, $returnbytes = true, $feedId = null)
{
$assetDownloadCurl = Plugin::$plugin->getSettings()->assetDownloadCurl;
$assetDownloadCurl = Plugin::$plugin->service->getConfig('assetDownloadCurl', $feedId);

// Provide some legacy support
if ($assetDownloadCurl) {
Expand Down Expand Up @@ -106,7 +107,7 @@ public static function fetchRemoteImage(array $urls, $fieldInfo, $feed, $field =
Plugin::info('Fetching remote image `{i}` - `{j}`', ['i' => $url, 'j' => $filename]);

if (!$cachedImage) {
self::downloadFile($url, $fetchedImage);
self::downloadFile($url, $fetchedImage, 1, true, $feed['id']);
} else {
$fetchedImage = $cachedImage[0];
}
Expand Down
4 changes: 2 additions & 2 deletions src/queue/jobs/FeedImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ class FeedImport extends BaseJob implements RetryableJobInterface
*/
public function getTtr()
{
return Plugin::$plugin->getSettings()->queueTtr ?? Plugin::getInstance()->queue->ttr;
return Plugin::$plugin->service->getConfig('queueTtr', $this->feed->id) ?? Plugin::getInstance()->queue->ttr;
}

/**
* @inheritDoc
*/
public function canRetry($attempt, $error)
{
$attempts = Plugin::$plugin->getSettings()->queueMaxRetry ?? Plugin::getInstance()->queue->attempts;
$attempts = Plugin::$plugin->service->getConfig('queueMaxRetry', $this->feed->id) ?? Plugin::getInstance()->queue->attempts;
return $attempt < $attempts;
}

Expand Down

0 comments on commit f6103d0

Please sign in to comment.