Merge pull request #3771 from sbyrx/master

Adds a configuration for podcast feed and episode download timeout
This commit is contained in:
advplyr 2025-01-08 14:10:20 -06:00 committed by GitHub
commit 05ff5f1956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -85,6 +85,12 @@ class Server {
} }
} }
if (process.env.PODCAST_DOWNLOAD_TIMEOUT) {
global.PodcastDownloadTimeout = process.env.PODCAST_DOWNLOAD_TIMEOUT
} else {
global.PodcastDownloadTimeout = 30000
}
if (!fs.pathExistsSync(global.ConfigPath)) { if (!fs.pathExistsSync(global.ConfigPath)) {
fs.mkdirSync(global.ConfigPath) fs.mkdirSync(global.ConfigPath)
} }

View File

@ -110,7 +110,7 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
headers: { headers: {
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org)' 'User-Agent': 'audiobookshelf (+https://audiobookshelf.org)'
}, },
timeout: 30000 timeout: global.PodcastDownloadTimeout
}).catch((error) => { }).catch((error) => {
Logger.error(`[ffmpegHelpers] Failed to download podcast episode with url "${podcastEpisodeDownload.url}"`, error) Logger.error(`[ffmpegHelpers] Failed to download podcast episode with url "${podcastEpisodeDownload.url}"`, error)
return null return null

View File

@ -281,7 +281,7 @@ module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => {
return axios({ return axios({
url: feedUrl, url: feedUrl,
method: 'GET', method: 'GET',
timeout: 12000, timeout: global.PodcastDownloadTimeout,
responseType: 'arraybuffer', responseType: 'arraybuffer',
headers: { headers: {
Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8', Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8',