[blam] Channel: don't artificially make downloading async
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] Channel: don't artificially make downloading async
- Date: Fri, 21 Jun 2013 00:59:57 +0000 (UTC)
commit c521f5b62c2cdec26a25568742c2e0157ebf56d5
Author: Carlos Martín Nieto <cmn dwim me>
Date: Fri Jun 21 02:59:03 2013 +0200
Channel: don't artificially make downloading async
Wrap the feed downloading in a task, but don't do it in a method that
doesn't call any async methods.
src/Channel.cs | 6 +++---
src/ChannelGroup.cs | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Channel.cs b/src/Channel.cs
index 205af12..76f9207 100644
--- a/src/Channel.cs
+++ b/src/Channel.cs
@@ -311,11 +311,11 @@ namespace Imendio.Blam {
return Conf.Get(Preference.IGNORE_SSL_ERR, false);
}
- async Task<SyndicationFeed> LoadFeedAsync(string url)
+ SyndicationFeed LoadFeed(string url)
{
var opts = new XmlReaderSettings();
opts.CheckCharacters = false;
- var reader = await Task.Run(() => XmlReader.Create(url, opts));
+ var reader = XmlReader.Create(url, opts);
return SyndicationFeed.Load(reader);
}
@@ -323,7 +323,7 @@ namespace Imendio.Blam {
{
ServicePointManager.ServerCertificateValidationCallback = ValidateCertificate;
try {
- var feed = await LoadFeedAsync(Url);
+ var feed = await Task.Run(() => LoadFeed(Url));
return Update(feed);
} catch (Exception e) {
diff --git a/src/ChannelGroup.cs b/src/ChannelGroup.cs
index 045022d..162c9b0 100644
--- a/src/ChannelGroup.cs
+++ b/src/ChannelGroup.cs
@@ -180,7 +180,8 @@ namespace Imendio.Blam
{
var tasks = Channels.Cast<Channel>().Select(c => c.RefreshAsync());
// FIXME: The continuation is a horrible hack to fit the interface
- return await Task.WhenAll(tasks).ContinueWith(task => true);
+ await Task.WhenAll(tasks);
+ return true;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]