mirror of
https://github.com/p-stream/providers.git
synced 2026-04-20 23:12:17 +00:00
Add skipInit flag to runSourceWithEmbeds to prevent duplicate init calls
This commit is contained in:
parent
1ec806bea8
commit
2a352cf6fb
1 changed files with 7 additions and 5 deletions
|
|
@ -81,7 +81,7 @@ export interface ProviderControls {
|
|||
|
||||
// Run a single source and its embeds (if any) with abort capability
|
||||
// returns the stream, or null if none found or aborted
|
||||
runSourceWithEmbeds(runnerOps: Omit<RunnerOptions, 'sourceOrder'> & { sourceId: string }): Promise<RunOutput | null>;
|
||||
runSourceWithEmbeds(runnerOps: Omit<RunnerOptions, 'sourceOrder'> & { sourceId: string; skipInit?: boolean }): Promise<RunOutput | null>;
|
||||
|
||||
// Run a specific source scraper
|
||||
runSourceScraper(runnerOps: SourceRunnerOptions): Promise<SourcererOutput>;
|
||||
|
|
@ -113,7 +113,7 @@ export function makeControls(ops: ProviderControlsInput): ProviderControls {
|
|||
};
|
||||
|
||||
const runSourceWithEmbeds = async (
|
||||
runnerOps: Omit<RunnerOptions, 'sourceOrder'> & { sourceId: string },
|
||||
runnerOps: Omit<RunnerOptions, 'sourceOrder'> & { sourceId: string; skipInit?: boolean },
|
||||
): Promise<RunOutput | null> => {
|
||||
const sourceItem = list.sources.find((s) => s.id === runnerOps.sourceId);
|
||||
if (!sourceItem) {
|
||||
|
|
@ -148,9 +148,11 @@ export function makeControls(ops: ProviderControlsInput): ProviderControls {
|
|||
},
|
||||
};
|
||||
|
||||
runnerOps.events?.init?.({
|
||||
sourceIds: sources.map((v) => v.id),
|
||||
});
|
||||
if (!runnerOps.skipInit) {
|
||||
runnerOps.events?.init?.({
|
||||
sourceIds: sources.map((v) => v.id),
|
||||
});
|
||||
}
|
||||
|
||||
for (const currentSource of sources) {
|
||||
// Check for abort before starting the source
|
||||
|
|
|
|||
Loading…
Reference in a new issue