01-27-09 - Urg Blogger GData

So my Blog poster code looks like :

for (int retries = 0; retries < 4; retries++)
    if (retries > 0)

        createdEntry = service.Insert(blogPostUri, newPost);
    catch (Exception e) //(...) // Google.GData.Client.GDataRequestException
        createdEntry = null;
        Console.WriteLine("service.Insert exception: " + e);

    Console.WriteLine("Retrying .. press a key");

I do the retry loop because the connection frequently closes itself and does other weird shit where it drops your request. This has been working for the last N months, but recently I've started getting exceptions even though the post goes up successfully. Urg.

+      [Google.GData.Client.GDataRequestException]   {"Execution of request failed: http://www.blogger.com/feeds/5246987755651065286/posts/default"}   Google.GData.Client.GDataRequestException
+      Data   {System.Collections.ListDictionaryInternal}   System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
      HelpLink   null   string
+      InnerException   {"The underlying connection was closed: The connection was closed unexpectedly."}   System.Exception {System.Net.WebException}
      Message   "Execution of request failed: http://www.blogger.com/feeds/5246987755651065286/posts/default"   string
      Source   "Google.GData.Client"   string
      StackTrace   "   at Google.GData.Client.GDataRequest.Execute()\r\n   at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)\r\n   at Google.GData.Client.GDataGAuthRequest.Execute()\r\n   at Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase baseEntry, GDataRequestType type, AsyncSendData data)\r\n   at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry, AsyncSendData data)\r\n   at Google.GData.Client.Service.Insert(Uri feedUri, AtomEntry newEntry)\r\n   at TextBlog.ConsoleApp.PostNewEntry(Service service, Uri blogPostUri, String title, String content, DateTime create, DateTime mod) in C:\\src\\TextBlog\\TextBlog\\Program.cs:line 164"   string
+      TargetSite   {Void Execute()}   System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

Developing for the web sucks donkey balls, cuz you have to talk to other people's services, and if they change anything about the way their stuff works, your stuff breaks. Urg.

Hmm, maybe it's this?

Why am I getting an HTTP 503 error code? 

There is an unspecified rate limit on the number of messages per user
per second. HTTP 503 indicates that the rate limit has been exceeded. To
handle this, consider implementing an exponential backoff algorithm and
an algorithm which interleaves small batches of emails from different

ADDENDUM : the answer seems to be one or both of these :

// http://code.google.com/p/google-gdata/wiki/KeepAliveAndUnderlyingConnectionIsClosed
((GDataRequestFactory)service.RequestFactory).KeepAlive = false;

//int t = ((GDataRequestFactory)service.RequestFactory).Timeout;
// get's and set's the Timeout property used for the created HTTPRequestObject in milliseconds. if you set it to -1 it will stick with the default of the HTPPRequestObject. From MSDN: The number of milliseconds to wait before the request times out. The default is 100,000 milliseconds (100 seconds).

// http://groups.google.com/group/gdata-dotnet-client-library/browse_thread/thread/99434d4d7df88e43?hl=en
System.Net.ServicePointManager.Expect100Continue = false;

Anyway, my blog poster is working again for the moment. But it's only a matter of time before changes in the site fuck me. I don't like that. I'm starting to miss my simple FTP poster that would just never ever change or ever have any problems. I have no patience any more for people "improving" software and breaking my shit. Like it's fine if you want to push new versions or whatever, but I want to keep the versions that work for me. You can't do that anymore. On the one hand you have reliance on OS components which you are forced to update, and on the other hand you have connection to web services which are changing constantly.

No comments:

old rants