0

I am using couchbase using the .NET client to interact with it. I need to be able to differentiate the cause of a failed call to my couchbase box and log them accurately. I've tried provoking a timeout in my testing environment but I have been unable to.

Reading the .net client documentation it appears that ExecuteGet returns an IGetOperationResult object that contains both an exception property and a status code property. The status codes would appear to correspond to this table. I haven't found in the documentation for the .NET client as to whether or not it throws an exception like the Java client. Also, the status codes from the memcached table doesn't seem to have a clear status code value that corresponds to a timeout.

How would one tell whether or not the configured timeout has been exceeded from a call besides not having a value returned?

4

1 回答 1

2

只有在发送来自服务器的响应时才设置 StatusCode 属性。超时将导致服务器没有响应,因此 StatusCode 为空。连接超时应导致在 GetOperationResult 上填充异常值...

https://github.com/couchbase/couchbase-net-client/blob/2dc8a63208dfa8b991290d128b14002ad4c43f53/src/Enyim.Caching/Memcached/PooledSocket.cs#L68

但是,很有可能在 Enyim 堆栈的更深处,原来的超时异常被吞并并重新包装在另一个异常中。当您遇到超时时,您是否看到 Exception 属性的任何值?

于 2013-07-30T17:32:12.890 回答