소스 검색

添加下载防卡死

xueyiming 1 개월 전
부모
커밋
cef3a4578f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/VideoDownloader.java

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/utils/other/VideoDownloader.java

@@ -104,7 +104,7 @@ public class VideoDownloader {
                 try (InputStream inputStream = connection.getInputStream();
                 try (InputStream inputStream = connection.getInputStream();
                      OutputStream outputStream = Files.newOutputStream(file.toPath())) {
                      OutputStream outputStream = Files.newOutputStream(file.toPath())) {
                     byte[] buffer = new byte[1024 * 1024];
                     byte[] buffer = new byte[1024 * 1024];
-                    long lastReadTime;
+                    long lastReadTime = System.currentTimeMillis();
                     int bytesRead;
                     int bytesRead;
                     while ((bytesRead = inputStream.read(buffer)) != -1) {
                     while ((bytesRead = inputStream.read(buffer)) != -1) {
                         outputStream.write(buffer, 0, bytesRead);
                         outputStream.write(buffer, 0, bytesRead);