private static STT.Task ExecuteCentralizedActivityAsync(IndexingActivityBase activity, CancellationToken cancellationToken) { SnTrace.Index.Write("ExecuteCentralizedActivity: #{0}", activity.Id); CentralizedIndexingActivityQueue.ExecuteActivity(activity); return(activity.WaitForCompleteAsync(cancellationToken)); }
private static async STT.Task ExecuteDistributedActivityAsync(IndexingActivityBase activity, CancellationToken cancellationToken) { SnTrace.Index.Write("ExecuteDistributedActivity: #{0}", activity.Id); await activity.DistributeAsync(cancellationToken).ConfigureAwait(false); // If there are too many activities in the queue, we have to drop at least the inner // data of the activity to prevent memory overflow. We still have to wait for the // activity to finish, but the inner data can (and will) be loaded from the db when // the time comes for this activity to be executed. if (DistributedIndexingActivityQueue.IsOverloaded()) { SnTrace.Index.Write("IAQ OVERLOAD drop activity FromPopulator A:" + activity.Id); activity.IndexDocumentData = null; } // all activities must be executed through the activity queue's API DistributedIndexingActivityQueue.ExecuteActivity(activity); await activity.WaitForCompleteAsync(cancellationToken).ConfigureAwait(false); }