c# - Getting a "A blocking operation was interrupted by a call to WSACancelBlockingCall" error when consuming Shipyard API using RestSharp -
i using restsharp consume shipyard api. able login, list nodes, list events, etc. when listing events, have problem. when have more 6 events, error:
a blocking operation interrupted call wsacancelblockingcall
this code running:
public async task<ienumerable<shipyardevent>> geteventsasync() { irestrequest geteventsrequest = createauthenticatedrequest("/api/events", method.get, null); irestresponse<list<shipyardevent>> requestresponse = await restclient.executegettaskasync<list<shipyardevent>>(geteventsrequest); ienumerable<shipyardevent> result = requestresponse.data; return result; } private irestrequest createauthenticatedrequest(string resource, method method, object body) { if (credentials == null) { throw new invalidoperationexception("this operation can performed logged in user."); } irestrequest result = createrequest(resource, method, body); result.addheader("x-access-token", $"{credentials.username}:{servicekey.authtoken}"); return result; } private irestrequest createrequest(string resource, method method, object body) { restrequest result = new restrequest(resource, method); result.requestformat = dataformat.json; if(body != null) result.addjsonbody(body); result.onbeforedeserialization = resp => { resp.contenttype = "application/json"; }; return result; }
a google search revealed cases there timeout, not case, have disabled timeout without success. when consuming docker api through shipyard same error, listing containers, if there more 2 containers. seems size of data in response triggering error. can't find relating restsharp error anywhere in previous searches. ideas on cause of error?
update: found 1 of problems was reusing same restclient instance both login , retrieve authentication token, , make requests token. if use instance per request, no longer error, request hangs forever no response, same thresholds before.
Comments
Post a Comment