smartsheet-platform / smartsheet-csharp-sdk

Library that uses C# to connect to Smartsheet services.
Apache License 2.0
35 stars 30 forks source link

Copying workspace timeout #137

Open mermich opened 2 years ago

mermich commented 2 years ago

When copying large workspace or worskapce that contains a large logic, the API call timeout :

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object.
   at Smartsheet.Api.SmartsheetRestException..ctor(Error error)
   at Smartsheet.Api.Internal.AbstractResources.HandleError(HttpResponse response)
   at Smartsheet.Api.Internal.AbstractResources.CreateResource[S,T](String path, T object)
   at Smartsheet.Api.Internal.WorkspaceResourcesImpl.CopyWorkspace(Int64 workspaceId, ContainerDestination destination, IEnumerable`1 include, IEnumerable`1 skipRemap)

This is mainly caused beacause the query is timing out. I increase the timeout of the RestClient, using my own implementatin of the DefaultHttpClient :

 public class TimeoutHttpClient : DefaultHttpClient
    {
        public TimeoutHttpClient() : base(new RestSharp.RestClient() { Timeout = 1_000_000, ReadWriteTimeout = 1_000_000 }, new JsonNetSerializer())
        {
        }
...

And so the error isn't now as part of the web call settings, but from the smartsheet server that is timing out. Can we gets some clarification why is this happening and any stratgey to handle this ?