mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
repair usage of CancellationToken
Co-Authored-By: n0099 <n@n0099.net>
This commit is contained in:
parent
1d5c87039e
commit
13b522e825
@ -60,7 +60,7 @@ namespace osu.Game.Database
|
|||||||
/// If specified CancellationToken, then use it. Otherwise use PostNotification's CancellationToken.
|
/// If specified CancellationToken, then use it. Otherwise use PostNotification's CancellationToken.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> ExportAsync(TModel model, CancellationToken? cancellationToken = null)
|
public async Task<bool> ExportAsync(TModel model, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
// check if the model is being exporting already
|
// check if the model is being exporting already
|
||||||
if (!exporting_models.Contains(model))
|
if (!exporting_models.Contains(model))
|
||||||
@ -93,7 +93,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
using (var stream = exportStorage.CreateFileSafely(filename))
|
using (var stream = exportStorage.CreateFileSafely(filename))
|
||||||
{
|
{
|
||||||
success = await ExportToStreamAsync(model, stream, notification, cancellationToken ?? notification.CancellationToken).ConfigureAwait(false);
|
success = await ExportToStreamAsync(model, stream, notification,
|
||||||
|
cancellationToken == CancellationToken.None ? notification.CancellationToken : cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
|
Loading…
Reference in New Issue
Block a user