-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor queue to prevent multiples streams
- Loading branch information
1 parent
45b2714
commit 0413061
Showing
4 changed files
with
170 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
import { Song } from "@prisma/client"; | ||
import { PlayingSong } from "types/app"; | ||
|
||
export interface PlayError { | ||
id: number; | ||
retryCount: number; | ||
} | ||
|
||
export enum ProcessQueueItemStatus { | ||
pending = "pending", | ||
processing = "processing", | ||
skipped = "skipped", | ||
error = "error", | ||
done = "done", | ||
} | ||
|
||
interface NonActiveItem { | ||
status: | ||
| ProcessQueueItemStatus.pending | ||
| ProcessQueueItemStatus.error | ||
| ProcessQueueItemStatus.skipped; | ||
song: Song; | ||
} | ||
|
||
interface ActiveItem { | ||
status: ProcessQueueItemStatus.processing; | ||
song: PlayingSong; | ||
} | ||
|
||
export type ProcessQueueItem = (NonActiveItem | ActiveItem) & { | ||
retryCount: number; | ||
callback: () => Promise<void>; | ||
}; |
Oops, something went wrong.