diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index adf26c53221919c8313a135996008f793b99b120..550dafc1e8c8aa56bb2a1e5b8ab500642504572a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ service_build: - docker build -t webapp-service --target build -f ./docker/Dockerfile.services . - mkdir image # - docker save webapp-service | gzip > image/service.tar.gz - + #artifacts: # paths: # - image @@ -172,12 +172,6 @@ deploy_diagnostic: SERVICE_NAME: diagnosticservice extends: .service_deploy -deploy_sketchpad: - variables: - ENV_NAME: whiteboard_production - SERVICE_NAME: whiteboardservice - extends: .service_deploy - #tag_deploy: # stage: deploy # tags: diff --git a/packages/whiteboard-service/src/services/pngstream.ts b/packages/whiteboard-service/src/services/pngstream.ts index 4968d3c0849c1618333e44aa25b7cb04211a52c3..ff21385744b48f4b9bac11cd025767dd418ba0b3 100644 --- a/packages/whiteboard-service/src/services/pngstream.ts +++ b/packages/whiteboard-service/src/services/pngstream.ts @@ -140,9 +140,7 @@ export default class PngStream { new Uint8Array([0]) // data ]; - await redisPublish(`stream-in:${this.uri}`, encode([0, spkt, dpkt])); - } public async sendFrame(img : Uint8Array) : Promise<void> { @@ -151,6 +149,11 @@ export default class PngStream { // return; } + if (!this.bActive) { + // restart stream if timed out due to inactivity + this.sendEventStartStream(); + } + this.frameNumber = Date.now(); const spkt = [ @@ -191,7 +194,6 @@ export default class PngStream { this.onMessage = (message) => { const buf = (typeof message === 'string') ? new Uint8Array(JSON.parse(message).data) : message; const dpkt = (decode(buf) as Array<any>)[2]; - //log("got request for frames: " + dpkt[2] + " (" + this.uri + ")"); // TODO: Do not re-send if connected client re-requests the frame (only useful to // re-send when more than one client connected). Interleaving can result in too // many sent frames if more than one client is connected. @@ -211,7 +213,7 @@ export default class PngStream { public async stop() : Promise<void> { this.sendEventStopStream(); - this.updateTimeout(); + this.updateTimeout(); // clears timer await redisUnsubscribe(`stream-out:${this.baseUri}`, this.onMessage); } }