Skip to content

Commit 27691cb

Browse files
Try to fix new exceptions
1 parent d578aae commit 27691cb

File tree

4 files changed

+11
-27
lines changed

4 files changed

+11
-27
lines changed

src/HotChocolate/Core/src/Features/PooledFeatureCollection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public void Reset()
161161
}
162162

163163
_features.Clear();
164+
_defaults = null;
165+
_containerRevision = 0;
164166
}
165167

166168
/// <inheritdoc />

src/HotChocolate/Core/src/Validation/DocumentValidator.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public DocumentValidatorResult Validate(
141141
}
142142
finally
143143
{
144-
ReturnContext(context);
144+
_contextPool.Return(context);
145145
}
146146
}
147147

@@ -155,9 +155,4 @@ private DocumentValidatorContext RentContext(
155155
context.Initialize(schema, documentId, document, _maxAllowedErrors, features);
156156
return context;
157157
}
158-
159-
private void ReturnContext(DocumentValidatorContext context)
160-
{
161-
_contextPool.Return(context);
162-
}
163158
}

src/HotChocolate/Core/src/Validation/Rules/FieldVisitor.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,21 +524,15 @@ protected internal override void Reset()
524524

525525
if (_buffers.Count > 1)
526526
{
527-
var buffer = _buffers.Pop();
528-
buffer.Clear();
529-
530-
for (var i = 0; i < _buffers.Count; i++)
527+
for (var i = 1; i < _buffers.Count; i++)
531528
{
532529
s_fieldInfoPool.Return(_buffers[i]);
533530
}
534531

535-
_buffers.Clear();
536-
_buffers.Push(buffer);
537-
}
538-
else
539-
{
540-
_buffers[0].Clear();
532+
_buffers.RemoveRange(1, _buffers.Count - 1);
541533
}
534+
535+
_buffers[0].Clear();
542536
}
543537
}
544538
}

src/HotChocolate/CostAnalysis/src/CostAnalysis/CostAnalyzer.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,19 @@ protected internal override void Reset()
370370
FieldSets.Clear();
371371
SelectionSetCost.Clear();
372372
Processed.Clear();
373+
InputCostVisitorContext.Clear();
373374

374375
if (_buffers.Count > 1)
375376
{
376-
var buffer = _buffers.Pop();
377-
buffer.Clear();
378-
379-
for (var i = 0; i < _buffers.Count; i++)
377+
for (var i = 1; i < _buffers.Count; i++)
380378
{
381379
s_fieldInfoPool.Return(_buffers[i]);
382380
}
383381

384-
_buffers.Clear();
385-
_buffers.Push(buffer);
386-
}
387-
else
388-
{
389-
_buffers[0].Clear();
382+
_buffers.RemoveRange(1, _buffers.Count - 1);
390383
}
391384

392-
InputCostVisitorContext.Clear();
385+
_buffers[0].Clear();
393386
}
394387
}
395388

0 commit comments

Comments
 (0)