mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-14 06:11:27 +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';
|
let binary_path = 'node_modules/youtube-dl/bin';
|
||||||
// versions different, download new update
|
// versions different, download new update
|
||||||
console.log('INFO: Found new update for youtube-dl. Updating binary...');
|
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) {
|
downloader(binary_path, function error(err, done) {
|
||||||
'use strict'
|
'use strict'
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -687,7 +691,7 @@ async function checkExistsWithTimeout(filePath, timeout) {
|
|||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
var timer = setTimeout(function () {
|
var timer = setTimeout(function () {
|
||||||
watcher.close();
|
if (watcher) watcher.close();
|
||||||
reject(new Error('File did not exists and was not created during the timeout.'));
|
reject(new Error('File did not exists and was not created during the timeout.'));
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user