Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions changelog.d/unreleased/2949.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
category: fixed
issues:
- 2949
affected:
- src/CodeIndex/Indexer/BoundedRegex.cs
- tests/CodeIndex.Tests/BoundedRegexTests.cs
---

## English

- **SQL reference extraction is less likely to drop matches under full-suite CPU contention (#2949)** - bounded regex matching now keeps a larger but still finite default timeout, reducing intermittent missed SQL references during heavily loaded test and indexing runs.

## 日本語

- **full-suite の CPU 競合下で SQL reference 抽出が match を落としにくくなりました (#2949)** - bounded regex matching の既定 timeout を、有限のまま余裕を持たせた値に変更し、高負荷なテスト実行や index 実行中に SQL reference が断続的に欠ける問題を減らしました。
3 changes: 2 additions & 1 deletion src/CodeIndex/Indexer/BoundedRegex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace CodeIndex.Indexer;

internal sealed class BoundedRegex : BclRegex
{
internal static readonly TimeSpan DefaultMatchTimeout = TimeSpan.FromMilliseconds(250);
// Keep regex matches bounded, but leave enough scheduler headroom for full-suite CI contention.
internal static readonly TimeSpan DefaultMatchTimeout = TimeSpan.FromSeconds(1);

public BoundedRegex(string pattern)
: base(pattern, RegexOptions.None, DefaultMatchTimeout)
Expand Down
15 changes: 15 additions & 0 deletions tests/CodeIndex.Tests/BoundedRegexTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using CodeIndex.Indexer;

namespace CodeIndex.Tests;

public sealed class BoundedRegexTests
{
[Fact]
public void DefaultMatchTimeout_KeepsBoundedMatchesFromTimingOutUnderNormalSchedulerContention()
{
Assert.InRange(
BoundedRegex.DefaultMatchTimeout,
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(5));
}
}
Loading