Skip to content

[MergeDups] Implement SignalRHub for duplicate finder #3725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Apr 16, 2025

Resolves #3720


This change is Reviewable

Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 25.58140% with 64 lines in your changes missing coverage. Please review.

Project coverage is 72.81%. Comparing base (1a241ca) to head (0320fb9).

Files with missing lines Patch % Lines
Backend/Controllers/MergeController.cs 15.78% 16 Missing ⚠️
Backend/Services/MergeService.cs 11.76% 15 Missing ⚠️
src/components/App/SignalRHub.tsx 0.00% 15 Missing ⚠️
src/goals/MergeDuplicates/MergeHub.tsx 0.00% 8 Missing ⚠️
src/goals/Redux/GoalActions.ts 66.66% 4 Missing and 2 partials ⚠️
src/components/ProjectExport/ExportHub.tsx 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3725      +/-   ##
==========================================
- Coverage   73.12%   72.81%   -0.31%     
==========================================
  Files         285      287       +2     
  Lines       10648    10707      +59     
  Branches     1328     1334       +6     
==========================================
+ Hits         7786     7796      +10     
- Misses       2467     2514      +47     
- Partials      395      397       +2     
Flag Coverage Δ
backend 81.83% <20.51%> (-0.54%) ⬇️
frontend 65.75% <29.78%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@imnasnainaec imnasnainaec marked this pull request as ready for review April 21, 2025 20:59
Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should investigate memory cache as an alternative to the ConcurrentDictionary.
https://learn.microsoft.com/en-us/dotnet/api/system.runtime.caching.memorycache?view=netframework-4.8

Reviewed 3 of 23 files at r1, 7 of 12 files at r4.
Reviewable status: 9 of 27 files reviewed, all discussions resolved (waiting on @imnasnainaec)

@imnasnainaec imnasnainaec marked this pull request as draft April 22, 2025 19:20
@imnasnainaec imnasnainaec marked this pull request as ready for review April 23, 2025 22:24
internal async Task<bool> GetDuplicatesThenSignal(string projectId, int maxInList, int maxLists, string userId)
{
// Use counter to ensure that only the most recent duplicate request succeeds per user.
var counter = Interlocked.Increment(ref _mergeCounter);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not clear to me, is there an assumption that _mergeCounter is persisted between requests? I would verify this as I believe by default controllers are request scoped and not singletons meaning each request _mergeCounter would start at 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch, thank you. Yes, it does need to be persisted, so I'll move that counter into the now-singleton Merge Service.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@imnasnainaec imnasnainaec marked this pull request as draft April 24, 2025 12:54
Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Investigated and discussed elsewhere.)

Reviewable status: 9 of 27 files reviewed, 1 unresolved discussion (waiting on @hahn-kev, @imnasnainaec, and @jasonleenaylor)

internal async Task<bool> GetDuplicatesThenSignal(string projectId, int maxInList, int maxLists, string userId)
{
// Use counter to ensure that only the most recent duplicate request succeeds per user.
var counter = Interlocked.Increment(ref _mergeCounter);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch, thank you. Yes, it does need to be persisted, so I'll move that counter into the now-singleton Merge Service.

@imnasnainaec imnasnainaec marked this pull request as ready for review April 24, 2025 13:41
Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 8 of 27 files reviewed, 1 unresolved discussion (waiting on @hahn-kev and @jasonleenaylor)

internal async Task<bool> GetDuplicatesThenSignal(string projectId, int maxInList, int maxLists, string userId)
{
// Use counter to ensure that only the most recent duplicate request succeeds per user.
var counter = Interlocked.Increment(ref _mergeCounter);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 22 files at r2, 1 of 3 files at r3, 4 of 12 files at r4, 3 of 3 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @hahn-kev)

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dismissed @hahn-kev from a discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @hahn-kev)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MergeDuplicate errors (524) if duplicate-finding takes longer than 100 seconds
3 participants