Skip to content
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

Decouple wiql from class instance #1609

Merged
merged 10 commits into from
Jun 21, 2023
Merged

Conversation

Onokaev
Copy link
Contributor

@Onokaev Onokaev commented Jun 20, 2023

Overview

Fixes #1608

Demo

Optional. Screenshots, curl examples, etc.

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Testing Instructions

  • How to test this PR
  • Prefer bulleted description
  • Start after checking out this branch
  • Include any setup required, such as bundling scripts, restarting services, etc.
  • Include test case, and expected output

@Onokaev Onokaev requested a review from a team as a code owner June 20, 2023 10:09
@Onokaev Onokaev marked this pull request as draft June 20, 2023 10:31
@Onokaev Onokaev marked this pull request as ready for review June 20, 2023 12:42
KnownIssuesService/Services/KnownIssuesService.cs Outdated Show resolved Hide resolved
KnownIssuesService/Services/KnownIssuesService.cs Outdated Show resolved Hide resolved
{
_telemetryClient?.TrackTrace("Fetches a WorkItemQueryResult for fetching work item Ids and urls",
SeverityLevel.Information,
_knownIssuesTraceProperties);
this.IssuesEnvironment = environment;
Copy link
Member

Choose a reason for hiding this comment

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

I suspect you may have issues with this being an instance variable. As the KnownIssuesService is a singleton in the project.

services.AddSingleton<IKnownIssuesService, KnownIssuesService.Services.KnownIssuesService>();
the same instance will be resolved.

When two simultaneous calls to the controller are made with different parameters, you may run into race condition as the same variable may be replaced with the second call before the first call completes.
I believe the parameter should pass down the call stack rather than setting a shared instance to be read later on by the GetQueryByWiqlAsync function call.
Same for the WorkItemQuery variable.

@sonarcloud
Copy link

sonarcloud bot commented Jun 20, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

69.2% 69.2% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@Onokaev Onokaev changed the title Tie wiql to class instance Decouple wiql from class instance Jun 21, 2023
@Onokaev Onokaev enabled auto-merge (squash) June 21, 2023 06:53
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

thanks for making the changes

@Onokaev Onokaev merged commit f5aab6d into dev Jun 21, 2023
8 of 9 checks passed
@Onokaev Onokaev deleted the task/switch-knowissues-organisations branch June 21, 2023 12:35
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.

Switch organisations when querying knownissues
3 participants