Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit ebc96cb

Browse files
committed
Correctly cleanup old containers on deployment update
Closes exoframejs/exoframe#253 Should also address exoframejs/exoframe#223
1 parent 867a374 commit ebc96cb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/routes/deploy.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,16 @@ module.exports = fastify => {
175175
const resultStream = _();
176176
// deploy new versions
177177
deploy({username, folder, payload: request.payload, resultStream});
178-
// schedule cleanup
179-
scheduleCleanup({username, project, existing});
180178
// reply with deploy stream
181179
const responseStream = new Readable().wrap(resultStream);
182180
reply.code(200).send(responseStream);
183-
// schedule temp folder cleanup on end
184-
responseStream.on('end', () => cleanTemp(folder));
181+
// schedule temp folder and container cleanup on deployment end
182+
responseStream.on('end', () => {
183+
// schedule container cleanup
184+
scheduleCleanup({username, project, existing});
185+
// clean temp folder
186+
cleanTemp(folder);
187+
});
185188
},
186189
});
187190
};

0 commit comments

Comments
 (0)