Пример #1
0
        internal async Task CommitAsync(CancellationToken cancelToken)
        {
            bool hasPendingWork = true;

            while (hasPendingWork)
            {
                if (!m_workerController.BeginWork())
                {
                    return;
                }

                hasPendingWork = false;
                this.NotifyStarting();
                try
                {
                    IList <string> changedItems = await m_changeTable.GetChangeQueueAsync();

                    if (!changedItems.IsNullOrEmpty())
                    {
                        await this.CommitChangesAsync(changedItems);
                    }
                }
                catch (Exception ex)
                {
                    this.NotifyError(ex);
                    throw;
                }
                finally
                {
                    this.NotifyFinished();
                    hasPendingWork = m_workerController.CompleteWork();
                }
            }
        }