Hi,
I am working on an application that will copy about 50,000 contacts
into a shared contacts domain list. I am using the new .NET libraries
to perform the inserts in batches of 100. Using the default timeout
settings, I am able to insert around 10,000 entries before I get a the
exception:
"Google.GData.Client.GDataRequestException: Execution of request
failed: http:/
www.google.com/m8/feeds/contacts/domain/full/batch --->
System.Net.WebException "The operation has timed out"
What I've noticed is that with each batch request, it takes more and
more time for a response to be returned. After the 100th request, it
takes almost 2 minutes for a response to be returned. If I ignore the
exception, I notice that the contacts are still being added correctly.
I am not sure if this has anything to do with it, but it is running
behind a proxy. I have included the method I am using.
// inserts 50,000 Contacts into the domain shared list
public void InsertContacts(IList<Contact> entries)
{
// feed is initially empty
Feed<Contact> feed = cRequest.GetContacts(domain);
Feed<Contact> results;
Console.WriteLine("Inserting {0} users. ", entries.Count);
Console.WriteLine("Shared contacts: " +
feed.TotalResults);
for (int i = 0; i < (entries.Count / batchCount) + 1; i++)
{
// get the range of contacts 100 or less.
int start = i * batchCount;
int end = Math.Min(batchCount, entries.Count - start);
List<Contact> list = ((List<Contact>)entries).GetRange
(start, end);
int id = 0;
foreach (Contact c in list)
{
// create batch data
c.BatchData = new GDataBatchEntryData();
c.BatchData.Id = (id++).ToString();
c.BatchData.Type = GDataBatchOperationType.insert;
}
int added = 0;
try
{
// perform batch and heck results for errors
results = cRequest.Batch(list, new Uri
(feed.AtomFeed.Batch), GDataBatchOperationType.insert);
added = CheckForErrors(results);
}
catch (GDataRequestException e)
{
Console.WriteLine(e.Message);
}
feed = cRequest.GetContacts(domain);
Console.WriteLine("Added: {0}, Total: {1}, Time:{2}",
added, feed.TotalResults, DateTime.Now);
}
Console.WriteLine("Insertion completed");
}
Any help would be appreciated.
Thanks,
Hussam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---