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

68 extend engine to have pause resume cancel operations #72

Merged

Conversation

gregyjames
Copy link
Owner

Description

Please include a summary of the change and which issue number is fixed. Also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #68

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Explain the Testing instructions

Test Configuration:

  • Operating system: MacOS
  • Version:
  • Text-editors used: Rider

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Attach Screenshots

@gregyjames gregyjames linked an issue Jan 19, 2023 that may be closed by this pull request
OctaneEngine/Engine.cs Fixed Show fixed Hide fixed
public class PauseTokenSource
{
private volatile TaskCompletionSource<bool> _paused;
private ILoggerFactory _factory;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity

Field '_factory' can be 'readonly'.
{
private volatile TaskCompletionSource<bool> _paused;
private ILoggerFactory _factory;
private ILogger _log;

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity

Field '_log' can be 'readonly'.
@@ -36,7 +38,10 @@
logging.AddSerilog(seriLog);
});

Engine.DownloadFile("https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png", factory, null, config).Wait();
var pauseTokenSource = new PauseTokenSource(factory);
var cancelTokenSource = new CancellationTokenSource();

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable

Disposable 'CancellationTokenSource' is created but not disposed.
OctaneEngine/Engine.cs Fixed Show fixed Hide fixed
@gregyjames gregyjames merged commit 0b8a90a into master Jan 19, 2023
config.DoneCallback(true);
config.DoneCallback.Invoke(success);

if (success == false)

Check notice

Code scanning / CodeQL

Unnecessarily complex Boolean expression

The expression 'A == false' can be simplified to '!A'.
Parts = 2,
BufferSize = 8192,
ShowProgress = false,
DoneCallback = c => Assert.IsTrue(!File.Exists(outFile) || c == false),

Check notice

Code scanning / CodeQL

Unnecessarily complex Boolean expression

The expression 'A == false' can be simplified to '!A'.
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.

Extend Engine to have Pause, Resume, Cancel operations
1 participant