Permalink
Browse files

perf(container): force remove container instead of graceful stop

  • Loading branch information...
jkuri committed Nov 11, 2017
1 parent 5ff62b9 commit c9093fe6f4b55cd8dc99a05ef20c46abbfefa2d5
Showing with 5 additions and 8 deletions.
  1. +1 −1 src/api/docker.ts
  2. +2 −2 src/api/socket.ts
  3. +2 −5 src/app/components/app-job/app-job.component.ts
@@ -196,7 +196,7 @@ export function killContainer(id: string): Promise<void> {
if (containerInfo.State.Status === 'exited') {
return container.remove();
} else if (containerInfo.State.Status === 'running') {
return container.stop().then(c => c.remove());
return container.remove({ force: true });
} else {
return Promise.resolve();
}
@@ -230,8 +230,8 @@ export class SocketServer {
break;

case 'subscribeToJobOutput':
const jobId = parseInt(event.data.jobId, 10);
const idx = processes.findIndex(proc => proc.job_id === jobId);
const jobId = Number(event.data.jobId);
const idx = processes.findIndex(proc => Number(proc.job_id) === jobId);
if (idx !== -1) {
const proc = processes[idx];
conn.next({ type: 'data', data: proc.log });
@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, NgZone, Inject } from '@angular/core';
import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
@@ -50,7 +50,6 @@ export class AppJobComponent implements OnInit, OnDestroy {
private timeService: TimeService,
private authService: AuthService,
private route: ActivatedRoute,
private ngZone: NgZone,
@Inject(DOCUMENT) private document: any,
private titleService: Title
) {
@@ -70,9 +69,7 @@ export class AppJobComponent implements OnInit, OnDestroy {
this.termSub = this.socketService.outputEvents
.subscribe(event => {
if (event.type === 'data' || event.type === 'exit' || event.type === 'container') {
if (typeof event.data === 'string') {
this.ngZone.run(() => this.terminalInput = event.data);
}
this.terminalInput = event.data;
} else if (event.type === 'job stopped' && event.data === this.id) {
this.processing = false;
} else if (event.type === 'job restarted' && event.data === this.id) {

0 comments on commit c9093fe

Please sign in to comment.