Skip to content

Commit

Permalink
Initial commit (#47268)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickliu-msft authored Nov 22, 2024
1 parent a0363ff commit 4d42d7b
Show file tree
Hide file tree
Showing 5 changed files with 877 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public bool SetTransferState(DataTransferState state)
public bool SetSkippedItemsState() => _status.SetSkippedItem();

internal bool CanPause()
=> DataTransferState.InProgress == _status.State;
=> DataTransferState.InProgress == _status.State || DataTransferState.Queued == _status.State;

public async Task PauseIfRunningAsync(CancellationToken cancellationToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,12 @@ public virtual async IAsyncEnumerable<JobPartInternal> ProcessJobToJobPartAsync(
{
try
{
await OnJobStateChangedAsync(DataTransferState.InProgress).ConfigureAwait(false);
// only change state to 'InProgress' if it was 'Queued'
// (this is to prevent 'Pausing' to be changed)
if (_dataTransfer.TransferStatus.State == DataTransferState.Queued)
{
await OnJobStateChangedAsync(DataTransferState.InProgress).ConfigureAwait(false);
}
}
catch (Exception ex)
{
Expand Down
Loading

0 comments on commit 4d42d7b

Please sign in to comment.