Ski
unread,May 11, 2012, 12:32:03 PM5/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RestSharp
Hi, I'm using RestClient to consume RackSpace's Rest web service. One
of my methods needs to keep polling the web service for the current
progress of a routine, and then do something when it is finished. The
problem I'm having is that every time I poll the server, I'm getting
the same (old) data. Does RestSharp use a cache? Is there a method to
clear it?
This is my code for polling the current progress:
var client = new RestClient(cmdURI);
client.ClearHandlers(); <-- This was a guess, I thought it
might clear the cache
string resource = "/images/"+imageID;
var request = new RestRequest(resource, Method.GET);
request.AddHeader("X-Auth-Token", authToken);
RestResponse response =
(RestResponse)client.Execute(request);
I run that code inside a while loop:
while (imageFinished == false)
{
image = imageCreationStatus(cmdURI, authToken,
newImageID);
imageStatus = image.status;
if (imageStatus == "ACTIVE")
imageFinished = true;
else
{
listBox1.Items.Add("image creation progress:
"+image.progress);
System.Threading.Thread.Sleep(10000);
}
}
MessageBox.Show("Image Created!");
What I see is listBox1 filling up with 'image creation progress: 0",
and even after the image is finished (I can verify using RackSpace's
web gui), it continues in an infinite loop saying it is currently 0.
Thanks,
Ronan