eyevinn-channel-engine 4.2.4 → 4.2.6

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.
@@ -255,8 +255,8 @@ var ChannelEngine = /** @class */ (function () {
255
255
  this.server.get('/health', this._handleAggregatedSessionHealth.bind(this));
256
256
  this.server.get('/health/:sessionId', this._handleSessionHealth.bind(this));
257
257
  this.server.get('/reset', this._handleSessionReset.bind(this));
258
- this.server.get(this.dummySubtitleEndpoint, this._handleDummySubtitleEndpoint.bind(this));
259
- this.server.get(this.subtitleSliceEndpoint, this._handleSubtitleSliceEndpoint.bind(this));
258
+ this.server.get(DefaultDummySubtitleEndpointPath, this._handleDummySubtitleEndpoint.bind(this));
259
+ this.server.get(DefaultSubtitleSpliceEndpointPath, this._handleSubtitleSliceEndpoint.bind(this));
260
260
  this.server.on('NotFound', function (req, res, err, next) {
261
261
  res.header("X-Instance-Id", _this.instanceId + "<".concat(version, ">"));
262
262
  return next();
@@ -126,31 +126,39 @@ var SharedSessionState = /** @class */ (function () {
126
126
  };
127
127
  SharedSessionState.prototype.setCurrentVod = function (hlsVod, opts) {
128
128
  return __awaiter(this, void 0, void 0, function () {
129
- var newHlsVodJson, isLeader;
129
+ var isLeader, currentVod;
130
130
  return __generator(this, function (_a) {
131
131
  switch (_a.label) {
132
132
  case 0:
133
133
  if (!this.sessionId) {
134
134
  throw new Error("shared session state store has not been initialized");
135
135
  }
136
- if (!this.store.isShared()) return [3 /*break*/, 3];
137
- return [4 /*yield*/, this.set("currentVod", hlsVod.toJSON())];
136
+ if (!this.store.isShared()) return [3 /*break*/, 7];
137
+ return [4 /*yield*/, this.store.clearLeaderCache()];
138
138
  case 1:
139
- newHlsVodJson = _a.sent();
139
+ _a.sent();
140
140
  return [4 /*yield*/, this.store.isLeader(this.instanceId)];
141
141
  case 2:
142
142
  isLeader = _a.sent();
143
- if (!isLeader) {
144
- debug("[".concat(this.sessionId, "]: not a leader, will not overwrite currentVod in shared store"));
145
- hlsVod = new HLSVod();
146
- hlsVod.fromJSON(newHlsVodJson);
147
- }
148
- return [3 /*break*/, 5];
149
- case 3: return [4 /*yield*/, this.set("currentVod", hlsVod)];
150
- case 4:
143
+ if (!isLeader) return [3 /*break*/, 4];
144
+ return [4 /*yield*/, this.set("currentVod", hlsVod.toJSON())];
145
+ case 3:
151
146
  _a.sent();
152
- _a.label = 5;
147
+ return [3 /*break*/, 6];
148
+ case 4:
149
+ debug("[".concat(this.sessionId, "]: Not a leader. Will not overwrite. Getting currentVod in shared store"));
150
+ return [4 /*yield*/, this.get("currentVod")];
153
151
  case 5:
152
+ currentVod = _a.sent();
153
+ hlsVod = new HLSVod();
154
+ hlsVod.fromJSON(currentVod);
155
+ _a.label = 6;
156
+ case 6: return [3 /*break*/, 9];
157
+ case 7: return [4 /*yield*/, this.set("currentVod", hlsVod)];
158
+ case 8:
159
+ _a.sent();
160
+ _a.label = 9;
161
+ case 9:
154
162
  if (this.cache.currentVod) {
155
163
  this.cache.currentVod.ts = Date.now();
156
164
  this.cache.currentVod.ttl = CURRENTVOD_CACHE_TTL;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@eyevinn/hls-repeat": "^0.2.0",
32
32
  "@eyevinn/hls-truncate": "^0.2.0",
33
- "@eyevinn/hls-vodtolive": "^3.0.0",
33
+ "@eyevinn/hls-vodtolive": "^3.0.1",
34
34
  "@eyevinn/m3u8": "^0.5.3",
35
35
  "abort-controller": "^3.0.0",
36
36
  "debug": "^3.2.7",
package/engine/server.ts CHANGED
@@ -349,8 +349,8 @@ export class ChannelEngine {
349
349
  this.server.get('/health', this._handleAggregatedSessionHealth.bind(this));
350
350
  this.server.get('/health/:sessionId', this._handleSessionHealth.bind(this));
351
351
  this.server.get('/reset', this._handleSessionReset.bind(this));
352
- this.server.get(this.dummySubtitleEndpoint, this._handleDummySubtitleEndpoint.bind(this));
353
- this.server.get(this.subtitleSliceEndpoint, this._handleSubtitleSliceEndpoint.bind(this));
352
+ this.server.get(DefaultDummySubtitleEndpointPath, this._handleDummySubtitleEndpoint.bind(this));
353
+ this.server.get(DefaultSubtitleSpliceEndpointPath, this._handleSubtitleSliceEndpoint.bind(this));
354
354
 
355
355
  this.server.on('NotFound', (req, res, err, next) => {
356
356
  res.header("X-Instance-Id", this.instanceId + `<${version}>`);
@@ -73,14 +73,16 @@ class SharedSessionState {
73
73
  if (!this.sessionId) {
74
74
  throw new Error("shared session state store has not been initialized");
75
75
  }
76
-
77
76
  if (this.store.isShared()) {
78
- let newHlsVodJson = await this.set("currentVod", hlsVod.toJSON());
77
+ await this.store.clearLeaderCache();
79
78
  const isLeader = await this.store.isLeader(this.instanceId);
80
- if (!isLeader) {
81
- debug(`[${this.sessionId}]: not a leader, will not overwrite currentVod in shared store`);
79
+ if (isLeader) {
80
+ await this.set("currentVod", hlsVod.toJSON());
81
+ } else {
82
+ debug(`[${this.sessionId}]: Not a leader. Will not overwrite. Getting currentVod in shared store`);
83
+ const currentVod = await this.get("currentVod");
82
84
  hlsVod = new HLSVod();
83
- hlsVod.fromJSON(newHlsVodJson);
85
+ hlsVod.fromJSON(currentVod);
84
86
  }
85
87
  } else {
86
88
  await this.set("currentVod", hlsVod);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyevinn-channel-engine",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "OTT TV Channel Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@eyevinn/hls-repeat": "^0.2.0",
32
32
  "@eyevinn/hls-truncate": "^0.2.0",
33
- "@eyevinn/hls-vodtolive": "^3.0.0",
33
+ "@eyevinn/hls-vodtolive": "^3.0.1",
34
34
  "@eyevinn/m3u8": "^0.5.3",
35
35
  "abort-controller": "^3.0.0",
36
36
  "debug": "^3.2.7",