Example #1
0
        internal void DeleteSpanInstances(string sqlConnectionString, int timeoutSecs, List <long> spanIds)
        {
            var batcher = new ItemBatcher <long>(spanIds, 250);

            var batch = batcher.GetBatch();

            while (batch != null)
            {
                var sql = $"delete from {QualifiedName} where span_id in ({batcher.GetAsCsv(batch)})";
                DatabaseUtils.ExecuteSql(sqlConnectionString, sql, timeoutSecs);

                batch = batcher.GetBatch();
            }
        }
Example #2
0
        public void CorrectlyRetrieves()
        {
            var ids      = GeneratedIds();
            int maxBatch = _random.Next(100, 200);
            var batcher  = new ItemBatcher <int>(ids, maxBatch);

            var finalIds = new HashSet <int>();

            var batch = batcher.GetBatch();

            while (batch != null)
            {
                Assert.IsTrue(batch.Any());
                Assert.IsTrue(batch.Count() <= maxBatch);

                finalIds.UnionWith(batch);

                batch = batcher.GetBatch();
            }

            Assert.AreEqual(finalIds.Count, ids.Count);
        }