mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-15 01:00:56 +03:00
Fixed bug where failed youtube-dl updates crashed the server (it should just continue uninterrupted)
This commit is contained in:
@@ -667,7 +667,11 @@ async function autoUpdateYoutubeDL() {
|
||||
let binary_path = 'node_modules/youtube-dl/bin';
|
||||
// versions different, download new update
|
||||
console.log('INFO: Found new update for youtube-dl. Updating binary...');
|
||||
await checkExistsWithTimeout(stored_binary_path, 10000);
|
||||
try {
|
||||
await checkExistsWithTimeout(stored_binary_path, 10000);
|
||||
} catch(e) {
|
||||
console.log(`ERROR: Failed to update youtube-dl - ${e}`);
|
||||
}
|
||||
downloader(binary_path, function error(err, done) {
|
||||
'use strict'
|
||||
if (err) {
|
||||
@@ -687,7 +691,7 @@ async function checkExistsWithTimeout(filePath, timeout) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var timer = setTimeout(function () {
|
||||
watcher.close();
|
||||
if (watcher) watcher.close();
|
||||
reject(new Error('File did not exists and was not created during the timeout.'));
|
||||
}, timeout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user