reducing avatars lookups for failed addresses

This commit is contained in:
Travis Glenn Hansen 2011-11-03 17:16:41 -06:00
parent d0a4d126fc
commit 04d13ef26b

View file

@ -81,6 +81,7 @@ namespace SparkleShare {
public abstract string PluginsPath { get; }
private SparkleFetcherBase fetcher;
private List<string> failed_avatars = new List<string> ();
// Short alias for the translations
@ -933,6 +934,8 @@ namespace SparkleShare {
old_avatars.Add (email);
}
} else if (this.failed_avatars.Contains (email)) {
break;
} else {
WebClient client = new WebClient ();
string url = "http://gravatar.com/avatar/" + GetMD5 (email) +
@ -954,8 +957,11 @@ namespace SparkleShare {
SparkleHelpers.DebugInfo ("Controller", "Failed fetching gravatar for " + email);
// Stop downloading further avatars if we have no internet access
if (e.Status == WebExceptionStatus.Timeout)
if (e.Status == WebExceptionStatus.Timeout){
break;
} else {
this.failed_avatars.Add (email);
}
}
}
}