eyevinn-channel-engine 5.0.0-rc.9 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -14
- package/dist/engine/preflight.d.ts +1 -1
- package/dist/engine/preflight.js +50 -9
- package/dist/engine/redis_state_store.d.ts +1 -1
- package/dist/engine/redis_state_store.js +58 -30
- package/dist/engine/server.d.ts +15 -15
- package/dist/engine/server.js +343 -340
- package/dist/engine/session.d.ts +3 -0
- package/dist/engine/session.js +310 -206
- package/dist/engine/session_live.d.ts +1 -0
- package/dist/engine/session_live.js +37 -6
- package/dist/engine/stream_switcher.d.ts +1 -1
- package/dist/engine/stream_switcher.js +78 -50
- package/dist/engine/util.d.ts +6 -1
- package/dist/engine/util.js +16 -1
- package/dist/examples/demux.js +52 -23
- package/dist/examples/livemix-demux.js +53 -17
- package/dist/examples/livemix.js +2 -2
- package/dist/package.json +54 -54
- package/engine/playhead_state.js +81 -81
- package/engine/preflight.js +43 -44
- package/engine/redis_state_store.js +208 -201
- package/engine/server.ts +1172 -1150
- package/engine/session.js +128 -45
- package/engine/session_live.js +2673 -2641
- package/engine/session_live_state.js +119 -119
- package/engine/session_state.js +247 -247
- package/engine/stream_switcher.js +999 -971
- package/engine/util.js +290 -275
- package/examples/demux.ts +171 -140
- package/examples/livemix-demux.ts +60 -20
- package/examples/livemix.ts +207 -207
- package/examples/multicodec.ts +105 -105
- package/package.json +54 -54
- package/spec/engine/init_switching_spec.js +908 -908
- package/spec/engine/playhead_live_spec.js +377 -378
- package/spec/engine/stream_switcher_spec.js +566 -566
- package/tsconfig.json +12 -12
package/README.md
CHANGED
|
@@ -32,17 +32,18 @@ Please see the [Documentation](https://vod2live.docs.eyevinn.technology) for int
|
|
|
32
32
|
|
|
33
33
|

|
|
34
34
|
|
|
35
|
-
A live demo and example is available here: [https://vod2live.eyevinn.technology](https://vod2live.eyevinn.technology)
|
|
36
|
-
|
|
37
35
|
## Features
|
|
38
36
|
|
|
39
37
|
- Produce 24/7 HLS live channels based on already transcoded HLS VODs
|
|
40
38
|
- Produce a personalized 24/7 HLS live channel unique for each viewer
|
|
41
39
|
- Mix VOD2Live channel with a "real" live HLS stream
|
|
42
40
|
- Develop adapters to plugin with custom scheduling endpoints
|
|
43
|
-
- High Availability with Redis Cache as shared state store
|
|
41
|
+
- High Availability with Redis Cache or Valkey as shared state store
|
|
44
42
|
- Support for WebVTT subtitles
|
|
45
43
|
- Support for DRM encrypted HLS VODs (in beta)
|
|
44
|
+
- Improved performance with Redis connection pooling and pipelining
|
|
45
|
+
- Enhanced stability in High Availability mode
|
|
46
|
+
- Support for livemix with demuxed content (TS and CMAF)
|
|
46
47
|
- And much more!
|
|
47
48
|
|
|
48
49
|
## System Requirements
|
|
@@ -57,24 +58,34 @@ Supported Node.js Versions
|
|
|
57
58
|
|
|
58
59
|
## Supported Source Formats
|
|
59
60
|
|
|
60
|
-
| HLS Format | Muxed | Demuxed | Mix w. Live | Subtitles | DRM |
|
|
61
|
-
| ---------- | ----- | ------- | ----------- | --------- | --- |
|
|
62
|
-
| HLS + TS | Yes | Yes | Yes
|
|
63
|
-
| HLS + CMAF |
|
|
61
|
+
| HLS Format | Muxed | Demuxed | Mix w. Live | Subtitles | Mix w. Live & Subtitles | DRM |
|
|
62
|
+
| ---------- | ----- | ------- | ----------- | --------- | ----------------------- | --- |
|
|
63
|
+
| HLS + TS | Yes | Yes | Yes | Yes | No | No |
|
|
64
|
+
| HLS + CMAF | Yes | Yes | Yes | Yes | No | No |
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
NOTE: The engine does not support subtitles in the live-mix + demux setting. Furthermore, then using the live-mix + demux setting, it is most optimal to use HLS content which has the same segment durations on all variants.
|
|
67
|
+
Using a mix of different segment durations may result in occasional playback/audio sync issues, but not always. Further development will be needed to resolve this and improve the robustness of the live-mix + demux experience.
|
|
66
68
|
|
|
67
69
|
## High Availability Support
|
|
68
70
|
|
|
69
|
-
[High availability support](https://vod2live.docs.eyevinn.technology/usage-guide.html#high-availability) is
|
|
71
|
+
[High availability support](https://vod2live.docs.eyevinn.technology/usage-guide.html#high-availability) is available in the Channel Engine and it uses Redis or Valkey as the shared storage. This allows you to run a replicaset behind a round-robin load balancer.
|
|
72
|
+
|
|
73
|
+
Supported Redis/Valkey Engine versions:
|
|
70
74
|
|
|
71
75
|
| Version | Supported |
|
|
72
76
|
| ------- | --------- |
|
|
73
77
|
| 5.x | Yes |
|
|
74
78
|
| 6.x | Yes |
|
|
75
|
-
| 7.x
|
|
79
|
+
| 7.x | No |
|
|
80
|
+
|
|
81
|
+
### Redis/Valkey Configuration
|
|
82
|
+
|
|
83
|
+
You can adjust Redis/Valkey connection pool size using the environment variable:
|
|
84
|
+
```
|
|
85
|
+
REDIS_POOL_SIZE=15 # Default is 15
|
|
86
|
+
```
|
|
76
87
|
|
|
77
|
-
## Usage
|
|
88
|
+
## Usage (Docker)
|
|
78
89
|
|
|
79
90
|
Follow [this tutorial](https://vod2live.docs.eyevinn.technology/getting-started.html) to get started building your own FAST channel engine.
|
|
80
91
|
|
|
@@ -88,8 +99,53 @@ docker run -d -p 8000:8000 -p 8001:8001 \
|
|
|
88
99
|
|
|
89
100
|
Open the URL http://localhost:8001/ in your browser for a multiview of all 50 channels, and to playback one of the 50 channels point your HLS video player to the URL: http://localhost:8000/channels/<N>/master.m3u8 where <N> is a number between 1 and 50.
|
|
90
101
|
|
|
102
|
+
## Usage (Eyevinn Open Source Cloud)
|
|
103
|
+
|
|
104
|
+
Available as an open web service in [Eyevinn Open Source Cloud (OSC)](https://www.osaas.io).
|
|
105
|
+
|
|
106
|
+
1. Sign up for an [OSC account](https://www.osaas.io)
|
|
107
|
+
2. Get the personal access token in the web console (Settings/API)
|
|
108
|
+
3. Store it in the environment variable `OSC_ACCESS_TOKEN` in your shell
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
% export OSC_ACCESS_TOKEN=<personal-access-token>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
4. Launch a channel called `guide` using the OSC command line tool.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
% npx -y @osaas/cli create channel-engine guide \
|
|
118
|
+
-o type=Loop \
|
|
119
|
+
-o url=https://lab.cdn.eyevinn.technology/osc/osc-reel/a4e1156e-f872-455f-9f1f-be73b5effba8/index.m3u8
|
|
120
|
+
Instance created:
|
|
121
|
+
{
|
|
122
|
+
id: 'eyevinnlab-guide',
|
|
123
|
+
name: 'guide',
|
|
124
|
+
type: 'Loop',
|
|
125
|
+
url: 'https://lab.cdn.eyevinn.technology/osc/osc-reel/a4e1156e-f872-455f-9f1f-be73b5effba8/index.m3u8',
|
|
126
|
+
playback: 'https://eyevinnlab.ce.prod.osaas.io/channels/guide/master.m3u8'
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This will create a linear channel by looping the Open Source Cloud demo reel video. Channel is available for playback on URL https://eyevinnlab.ce.prod.osaas.io/channels/guide/master.m3u8 in this case.
|
|
131
|
+
|
|
91
132
|
## Migration
|
|
92
133
|
|
|
134
|
+
### Upgrading from 4.x to >= 5.0.0
|
|
135
|
+
|
|
136
|
+
Version 5.0.0 introduces several significant improvements:
|
|
137
|
+
|
|
138
|
+
- **Web Framework Change**: Replaced Restify with Fastify for improved performance
|
|
139
|
+
- **Redis Improvements**: Added connection pooling and pipelining for better performance
|
|
140
|
+
- **Livemix Enhancements**: Support for demuxed content in both TS and CMAF formats
|
|
141
|
+
- **Stability Improvements**: Better handling of alignment in High Availability mode
|
|
142
|
+
- **Manifest Format Options**: Added option to disable legacy master manifest format
|
|
143
|
+
|
|
144
|
+
To migrate:
|
|
145
|
+
1. If you've extended the server functionality, you'll need to update your code to use Fastify instead of Restify
|
|
146
|
+
2. Review the new Redis pooling configuration options
|
|
147
|
+
3. Test your application thoroughly, especially if using High Availability mode
|
|
148
|
+
|
|
93
149
|
### Upgrading from 3.4.x to >= 4.0.0
|
|
94
150
|
|
|
95
151
|
Support for HLS-CMAF and handling audio and video segments of different durations was added to v4
|
|
@@ -137,7 +193,7 @@ DEBUG=engine-* npm start
|
|
|
137
193
|
|
|
138
194
|
In addition there other reference implemetations that can be used:
|
|
139
195
|
- `examples/demux.ts` : example with demuxed audio
|
|
140
|
-
- `examples/livemix.ts` : example with live
|
|
196
|
+
- `examples/livemix.ts` : example with live mixing
|
|
141
197
|
- `examples/multicodec.ts` : example with multicodec
|
|
142
198
|
- `examples/drm.ts` : example with DRM
|
|
143
199
|
- `examples/autocreate.ts` : example to auto create channel on demand
|
|
@@ -169,5 +225,4 @@ Join our [community on Slack](http://slack.streamingtech.se) where you can post
|
|
|
169
225
|
|
|
170
226
|
[Eyevinn Technology](https://www.eyevinntechnology.se) is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in [blogs](https://dev.to/video) and by open sourcing the code we have written.
|
|
171
227
|
|
|
172
|
-
Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!
|
|
173
|
-
|
|
228
|
+
Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function handler(req: any, res: any
|
|
1
|
+
export function handler(req: any, res: any): Promise<void>;
|
package/dist/engine/preflight.js
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
1
37
|
var constants = {
|
|
2
38
|
ALLOW_HEADERS: [
|
|
3
39
|
'accept',
|
|
@@ -30,14 +66,19 @@ var constants = {
|
|
|
30
66
|
STR_ORIGIN: 'origin',
|
|
31
67
|
HTTP_NO_CONTENT: 204
|
|
32
68
|
};
|
|
33
|
-
exports.handler = function (req, res
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
69
|
+
module.exports.handler = function (req, res) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
if (req.method !== 'OPTIONS')
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
res
|
|
75
|
+
.header(constants.AC_ALLOW_ORIGIN, '*')
|
|
76
|
+
.header(constants.AC_ALLOW_CREDS, 'true')
|
|
77
|
+
.header(constants.AC_ALLOW_METHODS, 'GET, OPTIONS')
|
|
78
|
+
.header(constants.AC_ALLOW_HEADERS, 'x-health-key')
|
|
79
|
+
.status(204)
|
|
80
|
+
.send();
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
});
|
|
41
83
|
});
|
|
42
|
-
res.send(constants.HTTP_NO_CONTENT);
|
|
43
84
|
};
|
|
@@ -5,7 +5,7 @@ declare class RedisStateStore {
|
|
|
5
5
|
volatileKeyTTL: any;
|
|
6
6
|
pool: any[];
|
|
7
7
|
createRedisPool(size: any, redisUrl: any): any[];
|
|
8
|
-
getClientFromPool(): any
|
|
8
|
+
getClientFromPool(maxWaitTime?: number): Promise<any>;
|
|
9
9
|
returnClientToPool(client: any): void;
|
|
10
10
|
initAsync(id: any, initData: any): Promise<{}>;
|
|
11
11
|
resetAsync(id: any, initData: any): Promise<void>;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
var Redis = require("ioredis");
|
|
38
38
|
var debug = require("debug")("redis-state-store");
|
|
39
|
-
var
|
|
39
|
+
var _a = require("./util.js"), cloudWatchLog = _a.cloudWatchLog, timer = _a.timer;
|
|
40
40
|
var DEFAULT_VOLATILE_KEY_TTL = 5; // Timeout so it should not expire within one normal increment iteration (in seconds)
|
|
41
41
|
function isTrue(s) {
|
|
42
42
|
var regex = /^\s*(true|1)\s*$/i;
|
|
@@ -67,8 +67,28 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
67
67
|
}
|
|
68
68
|
return pool;
|
|
69
69
|
};
|
|
70
|
-
RedisStateStore.prototype.getClientFromPool = function () {
|
|
71
|
-
|
|
70
|
+
RedisStateStore.prototype.getClientFromPool = function (maxWaitTime) {
|
|
71
|
+
if (maxWaitTime === void 0) { maxWaitTime = 5000; }
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var startTime;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0:
|
|
77
|
+
startTime = Date.now();
|
|
78
|
+
_a.label = 1;
|
|
79
|
+
case 1:
|
|
80
|
+
if (!(this.pool.length === 0)) return [3 /*break*/, 3];
|
|
81
|
+
if (Date.now() - startTime > maxWaitTime) {
|
|
82
|
+
console.error("[!] Timeout: No available Redis clients in the pool");
|
|
83
|
+
}
|
|
84
|
+
return [4 /*yield*/, timer(100)];
|
|
85
|
+
case 2:
|
|
86
|
+
_a.sent();
|
|
87
|
+
return [3 /*break*/, 1];
|
|
88
|
+
case 3: return [2 /*return*/, this.pool.pop()];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
72
92
|
};
|
|
73
93
|
RedisStateStore.prototype.returnClientToPool = function (client) {
|
|
74
94
|
this.pool.push(client);
|
|
@@ -133,24 +153,25 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
133
153
|
var client, err_1;
|
|
134
154
|
return __generator(this, function (_a) {
|
|
135
155
|
switch (_a.label) {
|
|
136
|
-
case 0:
|
|
137
|
-
client = this.getClientFromPool();
|
|
138
|
-
_a.label = 1;
|
|
156
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
139
157
|
case 1:
|
|
140
|
-
_a.
|
|
141
|
-
|
|
158
|
+
client = _a.sent();
|
|
159
|
+
_a.label = 2;
|
|
142
160
|
case 2:
|
|
161
|
+
_a.trys.push([2, 4, 5, 6]);
|
|
162
|
+
return [4 /*yield*/, client.flushall()];
|
|
163
|
+
case 3:
|
|
143
164
|
_a.sent();
|
|
144
165
|
console.log("Flushed Redis db");
|
|
145
|
-
return [3 /*break*/,
|
|
146
|
-
case
|
|
166
|
+
return [3 /*break*/, 6];
|
|
167
|
+
case 4:
|
|
147
168
|
err_1 = _a.sent();
|
|
148
169
|
console.error("Error flushing Redis db:", err_1);
|
|
149
|
-
return [3 /*break*/,
|
|
150
|
-
case
|
|
170
|
+
return [3 /*break*/, 6];
|
|
171
|
+
case 5:
|
|
151
172
|
this.returnClientToPool(client);
|
|
152
173
|
return [7 /*endfinally*/];
|
|
153
|
-
case
|
|
174
|
+
case 6: return [2 /*return*/];
|
|
154
175
|
}
|
|
155
176
|
});
|
|
156
177
|
});
|
|
@@ -161,8 +182,9 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
161
182
|
var _this = this;
|
|
162
183
|
return __generator(this, function (_a) {
|
|
163
184
|
switch (_a.label) {
|
|
164
|
-
case 0:
|
|
165
|
-
|
|
185
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
186
|
+
case 1:
|
|
187
|
+
client = _a.sent();
|
|
166
188
|
pipeline = client.pipeline();
|
|
167
189
|
data = {};
|
|
168
190
|
startMs = Date.now();
|
|
@@ -172,7 +194,7 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
172
194
|
pipeline.get(storeKey);
|
|
173
195
|
}
|
|
174
196
|
return [4 /*yield*/, pipeline.exec()];
|
|
175
|
-
case
|
|
197
|
+
case 2:
|
|
176
198
|
results = _a.sent();
|
|
177
199
|
ops = pipeline.length;
|
|
178
200
|
results.forEach(function (result, index) {
|
|
@@ -201,12 +223,13 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
201
223
|
var client, startMs, storeKey, reply, ioTimeMs;
|
|
202
224
|
return __generator(this, function (_a) {
|
|
203
225
|
switch (_a.label) {
|
|
204
|
-
case 0:
|
|
205
|
-
|
|
226
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
227
|
+
case 1:
|
|
228
|
+
client = _a.sent();
|
|
206
229
|
startMs = Date.now();
|
|
207
230
|
storeKey = "".concat(this.keyPrefix).concat(id).concat(key);
|
|
208
231
|
return [4 /*yield*/, client.get(storeKey)];
|
|
209
|
-
case
|
|
232
|
+
case 2:
|
|
210
233
|
reply = _a.sent();
|
|
211
234
|
ioTimeMs = Date.now() - startMs;
|
|
212
235
|
debug("REDIS get ".concat(storeKey, ":").concat(reply ? reply.length + " chars" : "null", " (").concat(ioTimeMs, "ms) ").concat(ioTimeMs > 1000 ? "REDISSLOW!" : ""));
|
|
@@ -231,8 +254,9 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
231
254
|
var _this = this;
|
|
232
255
|
return __generator(this, function (_b) {
|
|
233
256
|
switch (_b.label) {
|
|
234
|
-
case 0:
|
|
235
|
-
|
|
257
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
258
|
+
case 1:
|
|
259
|
+
client = _b.sent();
|
|
236
260
|
returnData = {};
|
|
237
261
|
startMs = Date.now();
|
|
238
262
|
pipeline = client.pipeline();
|
|
@@ -243,7 +267,7 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
243
267
|
pipeline.set(storeKey, JSON.stringify(value));
|
|
244
268
|
}
|
|
245
269
|
return [4 /*yield*/, pipeline.exec()];
|
|
246
|
-
case
|
|
270
|
+
case 2:
|
|
247
271
|
results = _b.sent();
|
|
248
272
|
ops = pipeline.length;
|
|
249
273
|
results.forEach(function (result, index) {
|
|
@@ -264,12 +288,13 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
264
288
|
var client, startMs, storeKey, res, ioTimeMs;
|
|
265
289
|
return __generator(this, function (_a) {
|
|
266
290
|
switch (_a.label) {
|
|
267
|
-
case 0:
|
|
268
|
-
|
|
291
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
292
|
+
case 1:
|
|
293
|
+
client = _a.sent();
|
|
269
294
|
startMs = Date.now();
|
|
270
295
|
storeKey = "".concat(this.keyPrefix).concat(id).concat(key);
|
|
271
296
|
return [4 /*yield*/, client.set(storeKey, JSON.stringify(value))];
|
|
272
|
-
case
|
|
297
|
+
case 2:
|
|
273
298
|
res = _a.sent();
|
|
274
299
|
ioTimeMs = Date.now() - startMs;
|
|
275
300
|
debug("REDIS set ".concat(storeKey, ": ").concat(res, " (").concat(ioTimeMs, "ms) ").concat(ioTimeMs > 1000 ? "REDISSLOW!" : ""));
|
|
@@ -289,9 +314,11 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
289
314
|
case 1:
|
|
290
315
|
data = _a.sent();
|
|
291
316
|
storeKey = "".concat(this.keyPrefix).concat(id).concat(key);
|
|
292
|
-
|
|
293
|
-
return [4 /*yield*/, client.expire(storeKey, this.volatileKeyTTL)];
|
|
317
|
+
return [4 /*yield*/, this.getClientFromPool()];
|
|
294
318
|
case 2:
|
|
319
|
+
client = _a.sent();
|
|
320
|
+
return [4 /*yield*/, client.expire(storeKey, this.volatileKeyTTL)];
|
|
321
|
+
case 3:
|
|
295
322
|
_a.sent();
|
|
296
323
|
debug("REDIS expire ".concat(storeKey, " ").concat(this.volatileKeyTTL, "s"));
|
|
297
324
|
this.returnClientToPool(client);
|
|
@@ -305,12 +332,13 @@ var RedisStateStore = /** @class */ (function () {
|
|
|
305
332
|
var client, startMs, storeKey, res, ioTimeMs;
|
|
306
333
|
return __generator(this, function (_a) {
|
|
307
334
|
switch (_a.label) {
|
|
308
|
-
case 0:
|
|
309
|
-
|
|
335
|
+
case 0: return [4 /*yield*/, this.getClientFromPool()];
|
|
336
|
+
case 1:
|
|
337
|
+
client = _a.sent();
|
|
310
338
|
startMs = Date.now();
|
|
311
339
|
storeKey = "".concat(this.keyPrefix).concat(id).concat(key);
|
|
312
340
|
return [4 /*yield*/, client.del(storeKey)];
|
|
313
|
-
case
|
|
341
|
+
case 2:
|
|
314
342
|
res = _a.sent();
|
|
315
343
|
ioTimeMs = Date.now() - startMs;
|
|
316
344
|
debug("REDIS remove ".concat(storeKey, ": (").concat(ioTimeMs, "ms) ").concat(ioTimeMs > 1000 ? "REDISSLOW!" : ""));
|
package/dist/engine/server.d.ts
CHANGED
|
@@ -169,19 +169,19 @@ export declare class ChannelEngine {
|
|
|
169
169
|
getMediaManifests(channelId: any): Promise<{}>;
|
|
170
170
|
getAudioManifests(channelId: any): Promise<{}>;
|
|
171
171
|
getSubtitleManifests(channelId: any): Promise<{}>;
|
|
172
|
-
_handleHeartbeat(
|
|
173
|
-
_handleMasterManifest(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
_handleEventStream(
|
|
180
|
-
_handleStatus(
|
|
181
|
-
_handleAggregatedSessionHealth(
|
|
182
|
-
_handleSessionHealth(
|
|
183
|
-
_handleSessionsReset(
|
|
184
|
-
_handleSessionReset(
|
|
185
|
-
_gracefulErrorHandler(errMsg: any):
|
|
186
|
-
_errorHandler(errMsg: any):
|
|
172
|
+
_handleHeartbeat(request: any, reply: any): void;
|
|
173
|
+
_handleMasterManifest(request: any, reply: any): Promise<void>;
|
|
174
|
+
_handleAudioManifest(request: any, reply: any): Promise<void>;
|
|
175
|
+
_handleSubtitleManifest(request: any, reply: any): Promise<void>;
|
|
176
|
+
_handleDummySubtitleEndpoint(request: any, reply: any): Promise<void>;
|
|
177
|
+
_handleSubtitleSliceEndpoint(request: any, reply: any): Promise<void>;
|
|
178
|
+
_handleMediaManifest(request: any, reply: any): Promise<void>;
|
|
179
|
+
_handleEventStream(request: any, reply: any): Promise<void>;
|
|
180
|
+
_handleStatus(request: any, reply: any): Promise<void>;
|
|
181
|
+
_handleAggregatedSessionHealth(request: any, reply: any): Promise<void>;
|
|
182
|
+
_handleSessionHealth(request: any, reply: any): Promise<void>;
|
|
183
|
+
_handleSessionsReset(request: any, reply: any): Promise<void>;
|
|
184
|
+
_handleSessionReset(request: any, reply: any): Promise<void>;
|
|
185
|
+
_gracefulErrorHandler(errMsg: any): Error;
|
|
186
|
+
_errorHandler(errMsg: any): Error;
|
|
187
187
|
}
|