Permalink
Browse files

NCBC-1561: Use GlobalTimeout for all operations in MemcachedBucket

Motivation
----------
Use GlobalTimeout property instead of _operationLifespanTimeout field in
IBucket implementations.

Modifications
-------------
 - Update MemcachedBucket to only use GlobalTimeout.

Result
------
MemcachedBucket has consistent usage of GlobalTimeout.

Change-Id: I105a7a251e1973b97804c4fc5547f37117befba0
Reviewed-on: http://review.couchbase.org/86346
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Jeffry Morris <jeffrymorris@gmail.com>
  • Loading branch information...
1 parent c3de11a commit b109b461066c82be1d320bc36325f1a8fe0a3c08 @jeffrymorris jeffrymorris committed Dec 4, 2017
@@ -1177,16 +1177,17 @@ public void LookupIn_ExecuteAsync_NoDeadlock(bool useMutation)
{
Setup(useMutation);
- var key = "MutateIn_ExecuteAsync_ModifiesDocument";
- await _bucket.UpsertAsync(key, new { foo = "bar", bar = "foo" });
+ var key = "MutateIn_ExecuteAsync_ModifiesDocument_" + useMutation;
+ var upsert = await _bucket.UpsertAsync(key, new { foo = "bar", bar = "foo" });
+ Assert.AreEqual(ResponseStatus.Success, upsert.Status);
var builder = _bucket.MutateIn<dynamic>(key).Replace("foo", "baz").Replace("bar", "fot");
var result = await builder.ExecuteAsync();
-
- Assert.IsTrue(result.Success);
+ Assert.AreEqual(ResponseStatus.Success, result.Status);
var document = await _bucket.GetDocumentAsync<dynamic>(key);
+ Assert.AreEqual(ResponseStatus.Success, document.Status);
Assert.AreEqual("baz", document.Content.foo.ToString());
Assert.AreEqual("fot", document.Content.bar.ToString());
@@ -602,7 +602,7 @@ public Task<IOperationResult<T>> UpsertAsync<T>(string key, T value, TimeSpan ex
/// <returns>An object implementing the <see cref="IOperationResult{T}"/>interface.</returns>
public IOperationResult<T> Upsert<T>(string key, T value, ulong cas)
{
- var operation = new Set<T>(key, value, null, _transcoder, _operationLifespanTimeout)
+ var operation = new Set<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds())
{
Cas = cas
};
@@ -1264,7 +1264,7 @@ public Task<IOperationResult<T>> ReplaceAsync<T>(string key, T value, TimeSpan e
/// <returns>An object implementing the <see cref="IOperationResult{T}"/>interface.</returns>
public IOperationResult<T> Replace<T>(string key, T value, ulong cas)
{
- var operation = new Replace<T>(key, value, cas, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Replace<T>(key, value, cas, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetry(operation);
}
@@ -1294,7 +1294,7 @@ public Task<IDocumentResult<T>> ReplaceAsync<T>(IDocument<T> document, Replicate
/// <returns>An object implementing the <see cref="IOperationResult{T}"/>interface.</returns>
public IOperationResult<T> Replace<T>(string key, T value)
{
- var operation = new Replace<T>(key, value, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Replace<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetry(operation);
}
@@ -1899,7 +1899,7 @@ public Task<IDocumentResult<T>> InsertAsync<T>(IDocument<T> document, ReplicateT
/// <returns>An object implementing the <see cref="IOperationResult{T}"/>interface.</returns>
public IOperationResult<T> Insert<T>(string key, T value)
{
- var operation = new Add<T>(key, value, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Add<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetry(operation);
}
@@ -3787,7 +3787,7 @@ public Task<IOperationResult<T>> GetAsync<T>(string key)
public Task<IOperationResult<T>> InsertAsync<T>(string key, T value)
{
CheckDisposed();
- var operation = new Add<T>(key, value, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Add<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetryAsync(operation);
}
@@ -4541,7 +4541,7 @@ public Task<IDocumentResult<T>[]> UpsertAsync<T>(List<IDocument<T>> documents, R
public Task<IOperationResult<T>> UpsertAsync<T>(string key, T value)
{
CheckDisposed();
- var operation = new Set<T>(key, value, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Set<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetryAsync(operation);
}
@@ -4903,7 +4903,7 @@ public Task<IDocumentResult<T>> ReplaceAsync<T>(IDocument<T> document, Replicate
public Task<IOperationResult<T>> ReplaceAsync<T>(string key, T value)
{
CheckDisposed();
- var operation = new Replace<T>(key, value, null, _transcoder, _operationLifespanTimeout);
+ var operation = new Replace<T>(key, value, null, _transcoder, GlobalTimeout.GetSeconds());
return _requestExecuter.SendWithRetryAsync(operation);
}

0 comments on commit b109b46

Please sign in to comment.