Bug 62544 - Settings:Restore

"_chunkedUploadSessionHolder.MoveAsync" before "_factoryIndexer.IndexAsync"
This commit is contained in:
Anton Suhorukov 2023-05-15 14:33:32 +03:00
parent 9995eed7bf
commit 078864ae24

View File

@ -393,7 +393,7 @@ internal class FileDao : AbstractDao, IFileDao<int>
return SaveFileAsync(file, fileStream, true);
}
public async Task<File<int>> SaveFileAsync(File<int> file, Stream fileStream, bool checkQuota = true)
public async Task<File<int>> SaveFileAsync(File<int> file, Stream fileStream, bool checkQuota = true, ChunkedUploadSession<int> uploadSession = null)
{
ArgumentNullException.ThrowIfNull(file);
@ -557,6 +557,13 @@ internal class FileDao : AbstractDao, IFileDao<int>
throw;
}
}
else
{
if(uploadSession != null)
{
await _chunkedUploadSessionHolder.MoveAsync(uploadSession, GetUniqFilePath(file));
}
}
_ = _factoryIndexer.IndexAsync(await InitDocumentAsync(toInsert));
@ -1154,8 +1161,7 @@ internal class FileDao : AbstractDao, IFileDao<int>
await _chunkedUploadSessionHolder.FinalizeUploadSessionAsync(uploadSession);
var file = await GetFileForCommitAsync(uploadSession);
await SaveFileAsync(file, null, uploadSession.CheckQuota);
await _chunkedUploadSessionHolder.MoveAsync(uploadSession, GetUniqFilePath(file));
await SaveFileAsync(file, null, uploadSession.CheckQuota, uploadSession);
return file;
}