From c8414f2714b6a289eb3f224cb5470c7ac8fcb87a Mon Sep 17 00:00:00 2001 From: Max Isom Date: Tue, 14 Feb 2023 19:12:19 -0800 Subject: [PATCH] Fix infinite loop Resolves https://github.com/codetheweb/muse/issues/884 --- CHANGELOG.md | 2 ++ src/services/youtube-api.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a0d76f..eaa13cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Queueing a YouTube playlist sometimes resulted in an infinite loop ## [2.1.8] - 2023-02-09 ### Changed diff --git a/src/services/youtube-api.ts b/src/services/youtube-api.ts index fd729b5..01a29dc 100644 --- a/src/services/youtube-api.ts +++ b/src/services/youtube-api.ts @@ -96,7 +96,7 @@ export default class { let nextToken: string | undefined; - while (playlistVideos.length !== playlist.contentDetails.itemCount) { + while (playlistVideos.length < playlist.contentDetails.itemCount) { // eslint-disable-next-line no-await-in-loop const {items, nextPageToken} = await this.cache.wrap( this.youtube.playlists.items,