Skip to content

Commit

Permalink
feat: option to set keep alive timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
birme committed Sep 12, 2023
1 parent 0fdda27 commit 423e460
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion engine/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export interface ChannelEngineOpts {
noSessionDataTags?: boolean;
volatileKeyTTL?: number;
autoCreateSession?: boolean;
sessionResetKey?:string;
sessionResetKey?: string;
keepAliveTimeout?: number;
}

interface StreamerOpts {
Expand Down Expand Up @@ -255,6 +256,11 @@ export class ChannelEngine {
this.assetMgr = assetMgr;
this.monitorTimer = {};
this.server = restify.createServer();
if (options && options.keepAliveTimeout) {
this.server.server.keepAliveTimeout = options.keepAliveTimeout;
this.server.server.headersTimeout = options.keepAliveTimeout + 1000;
}
console.log(this.server);
this.server.use(restify.plugins.queryParser());
this.serverStartTime = Date.now();
this.instanceId = uuidv4();
Expand Down
1 change: 1 addition & 0 deletions examples/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const engineOptions: ChannelEngineOpts = {
"https://maitv-vod.lab.eyevinn.technology/slate-consuo.mp4/master.m3u8",
slateRepetitions: 10,
redisUrl: process.env.REDIS_URL,
keepAliveTimeout: process.env.KEEP_ALIVE_TIMEOUT ? parseInt(process.env.KEEP_ALIVE_TIMEOUT) * 1000: undefined
};

const engine = new ChannelEngine(refAssetManager, engineOptions);
Expand Down

0 comments on commit 423e460

Please sign in to comment.