Couchbase.Management.BucketManager.WatchN1qlIndexesAsync C# (CSharp) Method

WatchN1qlIndexesAsync() public method

Watches all given indexes, asynchronously polling the query service until they are "online" or the has expired.
public WatchN1qlIndexesAsync ( List indexNames, System.TimeSpan watchTimeout ) : Task>>
indexNames List The list of indexes to watch for.
watchTimeout System.TimeSpan The timeout for the watch.
return Task>>
        public virtual async Task<IResult<List<IndexInfo>>> WatchN1qlIndexesAsync(List<string> indexNames, TimeSpan watchTimeout)
        {
            IndexResult result;
            var cancellationSource = new CancellationTokenSource(watchTimeout);

            do
            {
                result = await ListN1qlIndexesAsync();
                if (!ShouldRetryWatch(result, indexNames))
                {
                    break;
                }

                try
                {
                    await Task.Delay(WatchIndexSleepDuration, cancellationSource.Token);
                }
                catch (TaskCanceledException)
                {
                    break;
                }
            } while (!cancellationSource.IsCancellationRequested);

            return result;
        }