Skip to content

Commit

Permalink
Increase DownloadThreads to 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 19, 2023
1 parent a569956 commit a2c4117
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type DownloadProgress = { total: number; transferred: number; percent: number };
type Task = { video: Video; res: promiseFunction; formattedTitle: string };

const MaxRetries = 5;
const DownloadThreads = 8;

// Ew, I really need to refactor this monster of a class

Expand All @@ -41,7 +42,7 @@ export default class Downloader {

private tickQueue(): void {
if (this.runQueue === false) return;
while (this.taskQueue.length !== 0 && this.videosProcessing < 2) {
while (this.taskQueue.length !== 0 && this.videosProcessing < DownloadThreads) {
this.videosProcessing++;
this.barsQueued--;
const task = this.taskQueue.pop();
Expand Down Expand Up @@ -152,6 +153,10 @@ export default class Downloader {

let i = 0;
for await (const downloadRequest of video.download(settings.floatplane.videoResolution)) {
this.mpb?.addTask(formattedTitle, {
type: "percentage",
message: "Waiting on delivery cdn...",
});
((index) =>
downloadRequest.on("downloadProgress", (downloadProgress: DownloadProgress) => {
this.onDownloadProgress(startTime, totalBytes, index, downloadProgress, downloadedBytes, percentage, formattedTitle);
Expand Down
2 changes: 1 addition & 1 deletion src/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const fetchNewVideos = async (subscriptions: Array<Subscription>, videoProcessor
settings.floatplane.forceFullSearch
);
const seekVideos = await subscription.seekAndDestroy(await Promise.all(posts), settings.extras.stripSubchannelPrefix);
newVideos = [...newVideos, ...subVideos, ...seekVideos];
newVideos = [...subVideos, ...seekVideos];
}

if (newVideos.length !== 0) {
Expand Down

0 comments on commit a2c4117

Please sign in to comment.