Exemplo n.º 1
0
        public override void Delete(IEnumerable <ErrorStack> stacks)
        {
            var organizations = stacks.GroupBy(s => new {
                s.OrganizationId,
                s.ProjectId
            });

            foreach (var grouping in organizations)
            {
                var result = _collection.Remove(M.Query.In(FieldNames.Id, grouping.ToArray().Select(stack => new BsonObjectId(new ObjectId(stack.Id)))));

                if (result.DocumentsAffected <= 0)
                {
                    continue;
                }

                _organizationRepository.IncrementStats(grouping.Key.OrganizationId, stackCount: result.DocumentsAffected * -1);
                _projectRepository.IncrementStats(grouping.Key.ProjectId, stackCount: result.DocumentsAffected * -1);
            }

            foreach (ErrorStack entity in stacks)
            {
                // NOTE: We shouldn't need to call InvalidateHiddenId's here because they no longer exists.
                InvalidateCache(String.Concat(entity.ProjectId, entity.SignatureHash));
                base.InvalidateCache(entity);
            }
        }
Exemplo n.º 2
0
 private void IncrementOrganizationAndProjectErrorCounts(string organizationId, string projectId, long count)
 {
     _organizationRepository.IncrementStats(organizationId, errorCount: -count);
     _projectRepository.IncrementStats(projectId, errorCount: -count);
 }