예제 #1
0
        private async void WaitForReplicationFromServerAsync(string url, AsyncCountdownEvent countDown, Etag etag, BlockingCollection <Exception> errors)
        {
            try
            {
                while (countDown.Active)
                {
                    var etags = await GetReplicatedEtagsFor(url);

                    var replicated = etag.CompareTo(etags.DocumentEtag) <= 0 || etag.CompareTo(etags.AttachmentEtag) <= 0;

                    if (!replicated)
                    {
                        if (countDown.Active)
                        {
#if NET45
                            await Task.Delay(100);
#else
                            await TaskEx.Delay(100);
#endif
                        }
                        continue;
                    }
                    countDown.Signal();
                    return;
                }
            }
            catch (Exception ex)
            {
                errors.Add(ex);
                countDown.Error();
            }
        }