Skip to content

Commit

Permalink
config variables for delays
Browse files Browse the repository at this point in the history
  • Loading branch information
oshinongit committed Oct 13, 2023
1 parent fec6886 commit 5aeeb8a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions examples/encoreExample.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { EncorePipelineConfiguration } from '../src/pipelines/encore/encore-pipeline-configuration';
import { EncorePipeline, delay } from '../src/pipelines/encore/encore-pipeline';
import { EncoreInstance } from '../src/models/encoreInstance';
import path from 'path';
import fs from 'fs';

async function transcodeInputsAndAnalyze() {

Expand All @@ -14,6 +16,8 @@ async function transcodeInputsAndAnalyze() {
inputs: ["https://testcontent.eyevinn.technology/mp4/stswe-tvplus-promo.mp4"],
duration: 120,
priority: 0,
encorePollingInterval_ms: 30000,
encoreInstancePostCreationDelay_ms: 10000
};

const pipeline: EncorePipeline = new EncorePipeline(configuration);
Expand Down
2 changes: 2 additions & 0 deletions src/pipelines/encore/encore-pipeline-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ export type EncorePipelineConfiguration = {
inputs: Array<string>;
duration: number;
priority: number;
encorePollingInterval_ms: number;
encoreInstancePostCreationDelay_ms: number
};
7 changes: 4 additions & 3 deletions src/pipelines/encore/encore-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class EncorePipeline implements Pipeline {
enqueuedJobIds.splice(jobShouldBeProcessed, 1);
}
}
await delay(30000);
await delay(this.configuration.encorePollingInterval_ms);
}
}

Expand Down Expand Up @@ -294,7 +294,6 @@ export class EncorePipeline implements Pipeline {

let jobIds: string[] = [];
let references: string[] = [];
await delay(10000); // Delay required to allow instance to be created before calling it

for (let input of this.configuration.inputs) {
const job: EncoreJob = await this.createEncoreJob(instance, input);
Expand Down Expand Up @@ -327,6 +326,8 @@ async function dummymain() {
inputs: ["https://testcontent.eyevinn.technology/mp4/stswe-tvplus-promo.mp4"],
duration: 120,
priority: 0,
encorePollingInterval_ms: 30000,
encoreInstancePostCreationDelay_ms: 10000
};

const AWSConf: AWSPipelineConfiguration = {
Expand All @@ -348,7 +349,7 @@ async function dummymain() {
const pipeline: EncorePipeline = new EncorePipeline(configuration);
const instance: EncoreInstance = await pipeline.createEncoreInstance(configuration.apiAddress, configuration.token, configuration.instanceId, configuration.profile);
let jobIds: string[] = [];
await delay(10000);
await delay(pipeline.configuration.encoreInstancePostCreationDelay_ms);
for (let input of configuration.inputs) {
const job: EncoreJob = await pipeline.createEncoreJob(instance, input);
jobIds.push(job.id);
Expand Down

0 comments on commit 5aeeb8a

Please sign in to comment.