Skip to content

Commit e95697f

Browse files
authored
[cuebot] Fix bug preventing dispatching with a single active show (AcademySoftwareFoundation#2327)
When there's only one active show, the logic to randomize show order inadvertently removes it from the list, leading to a frozen queue. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved shuffle behavior so host dispatching now randomizes show order correctly when shuffle is enabled. * **Tests** * Updated unit test expectations to reflect the corrected dispatch behavior. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/AcademySoftwareFoundation/OpenCue/pull/2327) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 5d62865 commit e95697f

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

cuebot/src/main/java/com/imageworks/spcue/dao/postgres/DispatcherDaoJdbc.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,8 @@ private String handleInClause(String key, String query, int inValueLength) {
191191
private Set<String> findDispatchJobs(DispatchHost host, int numJobs, boolean shuffleShows) {
192192
LinkedHashSet<String> result = new LinkedHashSet<String>();
193193
List<SortableShow> shows = new LinkedList<SortableShow>(getBookableShows(host));
194-
// shows were sorted. If we want it in random sequence, we need to shuffle it.
194+
// Shuffle shows to get them processed randomly
195195
if (shuffleShows) {
196-
if (!shows.isEmpty())
197-
shows.remove(0);
198196
Collections.shuffle(shows);
199197
}
200198

cuebot/src/test/java/com/imageworks/spcue/test/dispatcher/CoreUnitDispatcherTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public void testdispatchHostToAllShows() {
131131
DispatchHost host = getHost();
132132

133133
List<VirtualProc> procs = dispatcher.dispatchHostToAllShows(host);
134-
// The first show is removed. findDispatchJobs: shows.remove(0).
135-
assertEquals(0, procs.size());
134+
assertEquals(1, procs.size());
136135
}
137136

138137
@Test

0 commit comments

Comments
 (0)