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

added test coverage for cases where the task is not via ThrowIfCancel… #463

Conversation

julienasp
Copy link
Contributor

If the task is not cancelled via ThrowIfCancellationRequested(), we still handle it correctly in the implementation but no test were made for those.

@julienasp
Copy link
Contributor Author

if (successTask == delayTask)
{
    // depending on the implementation ThrowIfCancellationRequested() might not be called    
    cts.Cancel(); 
    _ = await moveNextTask.ConfigureAwait(false);
  
    // this covers it but no test were made for that, so i added 2 to make it explicit
    throw new TimeoutException("The operation has timed out."); 
}
							

@julienasp
Copy link
Contributor Author

this also made me realise that you didnt go with cts.CancelAfter is it for performance reasons @viceroypenguin ?

@codecov
Copy link

codecov bot commented May 28, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.03 ⚠️

Comparison is base (ac70110) 91.43% compared to head (c4e9c1b) 91.41%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #463      +/-   ##
==========================================
- Coverage   91.43%   91.41%   -0.03%     
==========================================
  Files         245      245              
  Lines        7932     7932              
  Branches     1609     1609              
==========================================
- Hits         7253     7251       -2     
- Misses        461      463       +2     
  Partials      218      218              

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@viceroypenguin
Copy link
Owner

this also made me realise that you didnt go with cts.CancelAfter is it for performance reasons?

cts.CancelAfter() will always cancel the CTS. This means that you can't reuse the same CTS for every loop. You can't use .CancelAfter() and undo the cancellation if something happens that you wanted to happen.

@viceroypenguin
Copy link
Owner

Could you please rebase your branch off latest in viceroypenguin/SuperLinq? There are a lot of changes this branch is missing, which affects the codecov evaluation.

@julienasp julienasp force-pushed the julienasp/2023/AddPerElementTimeout branch from 356765a to e130f43 Compare May 28, 2023 02:22
@julienasp
Copy link
Contributor Author

Could you please rebase your branch off latest in viceroypenguin/SuperLinq? There are a lot of changes this branch is missing, which affects the codecov evaluation.

image

i'll push that, it should be good now

@julienasp julienasp force-pushed the julienasp/2023/AddPerElementTimeout branch from e130f43 to c4e9c1b Compare May 28, 2023 02:29
@viceroypenguin viceroypenguin merged commit 2a67bd8 into viceroypenguin:master May 28, 2023
@viceroypenguin
Copy link
Owner

Thanks for adding the tests!

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.

2 participants