Skip to content

fix: tolerate concurrent channel creation - #118

Open
vycdev2 wants to merge 1 commit into
vycdev:developfrom
vycdev2:fix/concurrent-channel-creation
Open

fix: tolerate concurrent channel creation#118
vycdev2 wants to merge 1 commit into
vycdev:developfrom
vycdev2:fix/concurrent-channel-creation

Conversation

@vycdev2

@vycdev2 vycdev2 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Handle the unique-key race when multiple handlers first observe the same Discord channel.
  • Clear the failed insert, reload the winning row, and preserve the existing channel-name update behavior.
  • Add a SQLite regression test that simulates a competing channel creation; no schema changes.

Verification

  • dotnet test Morpheus.Tests/Morpheus.Tests.csproj --filter 'FullyQualifiedName~ChannelServiceConcurrencyTests' — passed: 1/1 after the fix; the same test failed before the fix with the simulated DbUpdateException.
  • dotnet test Morpheus.Tests/Morpheus.Tests.csproj --no-restore --filter 'FullyQualifiedName~ChannelService' — passed: 2/2.
  • dotnet build --no-restore — passed: 0 errors; one existing NU1903 SQLite vulnerability warning.
  • dotnet format Morpheus.sln --no-restore --verify-no-changes --include Services/ChannelService.cs Morpheus.Tests/ChannelServiceConcurrencyTests.cs — passed.
  • dotnet test --no-restore — 298 passed, 2 failed: existing MiscModuleTests.NormalizeTimeUntilEventName_NormalizesCase cases cannot load tr-TR under this runner's globalization-invariant mode.
  • git diff --check — passed.

Risk

Low: the change only handles a database unique-key conflict during channel creation and reuses the existing unique DiscordId index; unrelated database errors are rethrown when no competing row is found.

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant