Skip to content
Permalink
Browse files

Minor fixes:

- Wait for stopping containers before deleting network
- Handle version timeout in frontend
- Fix delete app in openapi.yml
  • Loading branch information...
schrieveslaach committed Feb 20, 2019
1 parent e3d051b commit c7bb9d10b933e745eac8b5204f5e4d5fb173b2a9
Showing with 18 additions and 17 deletions.
  1. +9 −4 api/res/openapi.yml
  2. +6 −11 api/src/services/docker/docker_infrastructure.rs
  3. +3 −2 frontend/src/store/index.js
@@ -78,15 +78,20 @@ paths:
type: string
required: true
description: Name of review app to delete
requestBody:
description: ''
required: false
content:
application/json:
responses:
'200':
description: 'List of deleted containers'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Service'
schema:
type: array
items:
$ref: '#/components/schemas/Service'
/webhooks/:
post:
summary: Cleans up apps when webhook triggers this resource.
@@ -482,22 +482,17 @@ impl Infrastructure for DockerInfrastructure {
let mut runtime = Runtime::new()?;
let container_ids: Vec<String> = runtime.block_on(future)?;

let mut container_details_futures = Vec::new();
let mut stop_futures = Vec::new();
for id in container_ids {
let id_clone = id.clone();
let future = containers
.get(&id)
.stop(None)
.map(move |_| {
let docker = Docker::new();
let container = docker.containers().get(&id_clone);
container.inspect()
})
.and_then(|container_details| container_details);

container_details_futures.push(future);
.stop(None);

stop_futures.push(future);
}

runtime.block_on(join_all(stop_futures))?;

self.delete_network(app_name)?;

Ok(services)
@@ -169,9 +169,10 @@ export default new Vuex.Store( {
return;
}

promises.push( timeout(500, fetch( container.versionUrl )
promises.push( timeout( 2000, fetch( container.versionUrl )
.then( res => res.ok ? res.json() : undefinedVersion )
.then( version => ( { name, containerIndex, version } ) ) ) );
.then( version => ( { name, containerIndex, version } ) ) )
.catch( err => ( { name, containerIndex, version: undefinedVersion } ) ) );
} );

Promise.all(promises)

0 comments on commit c7bb9d1

Please sign in to comment.
You can’t perform that action at this time.