🚸 feat: Add logic to handle file redownload when it cannot be deleted
This commit is contained in:
parent
49af0b2f2d
commit
7a30f1a112
1 changed files with 7 additions and 0 deletions
|
|
@ -439,6 +439,13 @@ public class TelegramVerticle extends AbstractVerticle {
|
||||||
if (!isPaused && file.local.isDownloadingActive) {
|
if (!isPaused && file.local.isDownloadingActive) {
|
||||||
return Future.failedFuture("File is downloading");
|
return Future.failedFuture("File is downloading");
|
||||||
}
|
}
|
||||||
|
if (!isPaused && !file.local.canBeDeleted) {
|
||||||
|
// Maybe the file is not exist, so we need to redownload it
|
||||||
|
return DataVerticle.fileRepository.getByUniqueId(file.remote.uniqueId)
|
||||||
|
.compose(fileRecord ->
|
||||||
|
client.execute(new TdApi.AddFileToDownloads(fileId, fileRecord.chatId(), fileRecord.messageId(), 32)))
|
||||||
|
.mapEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
return client.execute(new TdApi.ToggleDownloadIsPaused(fileId, isPaused));
|
return client.execute(new TdApi.ToggleDownloadIsPaused(fileId, isPaused));
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue