Skip to content

Commit

Permalink
Adds a configuration for podcast feed and episode download timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
sbyrx committed Jan 1, 2025
1 parent 727310a commit f0b4104
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions server/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class Server {
}
}

if (process.env.FILE_DOWNLOAD_TIMEOUT) {
global.FileDownloadTimeout = process.env.FILE_DOWNLOAD_TIMEOUT
} else {
global.FileDownloadTimeout = 30000
}

if (!fs.pathExistsSync(global.ConfigPath)) {
fs.mkdirSync(global.ConfigPath)
}
Expand Down
2 changes: 1 addition & 1 deletion server/utils/ffmpegHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module.exports.downloadPodcastEpisode = (podcastEpisodeDownload) => {
headers: {
'User-Agent': 'audiobookshelf (+https://audiobookshelf.org)'
},
timeout: 30000
timeout: global.FileDownloadTimeout
}).catch((error) => {
Logger.error(`[ffmpegHelpers] Failed to download podcast episode with url "${podcastEpisodeDownload.url}"`, error)
return null
Expand Down
2 changes: 1 addition & 1 deletion server/utils/podcastUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ module.exports.getPodcastFeed = (feedUrl, excludeEpisodeMetadata = false) => {
return axios({
url: feedUrl,
method: 'GET',
timeout: 12000,
timeout: global.FileDownloadTimeout,
responseType: 'arraybuffer',
headers: {
Accept: 'application/rss+xml, application/xhtml+xml, application/xml, */*;q=0.8',
Expand Down

0 comments on commit f0b4104

Please sign in to comment.