summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-07-11 11:21:19 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-07-11 11:21:19 +0200
commitb8a613351f042574de1eff8a9b403501e2cef146 (patch)
tree730f28f282611194662c6d0edf2ad1846268ce87
parent8970709e9ea435ac814af4ed9724b573ff9bbecc (diff)
increase timeout to from 10 to 60 seconds, fix #278
-rw-r--r--dependencyinjection/dicontainer.php2
-rw-r--r--tests/unit/utility/FeedFetcherTest.php6
-rw-r--r--utility/feedfetcher.php4
3 files changed, 12 insertions, 0 deletions
diff --git a/dependencyinjection/dicontainer.php b/dependencyinjection/dicontainer.php
index 92cb0ffcb..c3e4468cb 100644
--- a/dependencyinjection/dicontainer.php
+++ b/dependencyinjection/dicontainer.php
@@ -76,6 +76,7 @@ class DIContainer extends BaseContainer {
// undo actions
$this['autoPurgeCount'] = 200; // number of allowed unread articles per feed
$this['simplePieCacheDuration'] = 30*60; // seconds
+ $this['feedFetcherTimeout'] = 60; // seconds
$this['simplePieCacheDirectory'] = $this->share(function($c) {
$directory = $c['API']->getSystemValue('datadirectory') .
@@ -242,6 +243,7 @@ class DIContainer extends BaseContainer {
$c['TimeFactory'],
$c['simplePieCacheDirectory'],
$c['simplePieCacheDuration'],
+ $c['feedFetcherTimeout'],
$c['HTMLPurifier']);
});
diff --git a/tests/unit/utility/FeedFetcherTest.php b/tests/unit/utility/FeedFetcherTest.php
index b783da296..94339fe96 100644
--- a/tests/unit/utility/FeedFetcherTest.php
+++ b/tests/unit/utility/FeedFetcherTest.php
@@ -43,6 +43,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
private $time;
private $item;
private $purifier;
+ private $fetchTimeout;
// items
private $permalink;
@@ -91,12 +92,14 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
->will($this->returnValue($this->time));
$this->cacheDuration = 100;
$this->cacheDirectory = 'dir/';
+ $this->fetchTimeout = 40;
$this->fetcher = new FeedFetcher($this->getAPIMock(),
$this->coreFactory,
$this->faviconFetcher,
$timeFactory,
$this->cacheDirectory,
$this->cacheDuration,
+ $this->fetchTimeout,
$this->purifier);
$this->url = 'tests';
@@ -132,6 +135,9 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility {
->method('enable_cache')
->with($this->equalTo(true));
$this->core->expects($this->once())
+ ->method('set_timeout')
+ ->with($this->equalTo($this->fetchTimeout));
+ $this->core->expects($this->once())
->method('set_cache_location')
->with($this->equalTo($this->cacheDirectory));
$this->core->expects($this->once())
diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php
index cd3308cff..fc301b31e 100644
--- a/utility/feedfetcher.php
+++ b/utility/feedfetcher.php
@@ -41,6 +41,7 @@ class FeedFetcher implements IFeedFetcher {
private $cacheDuration;
private $faviconFetcher;
private $simplePieFactory;
+ private $fetchTimeout;
private $time;
private $purifier;
@@ -50,6 +51,7 @@ class FeedFetcher implements IFeedFetcher {
TimeFactory $time,
$cacheDirectory,
$cacheDuration,
+ $fetchTimeout,
$purifier){
$this->api = $api;
$this->cacheDirectory = $cacheDirectory;
@@ -58,6 +60,7 @@ class FeedFetcher implements IFeedFetcher {
$this->simplePieFactory = $simplePieFactory;
$this->time = $time;
$this->purifier = $purifier;
+ $this->fetchTimeout = $fetchTimeout;
}
@@ -79,6 +82,7 @@ class FeedFetcher implements IFeedFetcher {
$simplePie = $this->simplePieFactory->getCore();
$simplePie->set_feed_url($url);
$simplePie->enable_cache(true);
+ $simplePie->set_timeout($this->fetchTimeout);
$simplePie->set_cache_location($this->cacheDirectory);
$simplePie->set_cache_duration($this->cacheDuration);