fix(recorders): add S3_REGION to container env, accept 304/404 on stop/remove
This commit is contained in:
parent
e796a0d15f
commit
a9cc8caf42
1 changed files with 5 additions and 3 deletions
|
|
@ -180,6 +180,7 @@ router.post('/:id/start', async (req, res, next) => {
|
|||
`S3_BUCKET=${s3Bucket}`,
|
||||
`S3_ACCESS_KEY=${s3AccessKey}`,
|
||||
`S3_SECRET_KEY=${s3SecretKey}`,
|
||||
`S3_REGION=${process.env.S3_REGION || 'us-east-1'}`,
|
||||
`MAM_API_URL=${mamApiUrl}`,
|
||||
`RECORDER_ID=${id}`,
|
||||
`SOURCE_TYPE=${recorder.source_type}`,
|
||||
|
|
@ -263,20 +264,21 @@ router.post('/:id/stop', async (req, res, next) => {
|
|||
`/containers/${recorder.container_id}/stop`
|
||||
);
|
||||
|
||||
if (stopRes.status !== 204) {
|
||||
// 204 = stopped, 304 = already stopped — both are acceptable
|
||||
if (stopRes.status !== 204 && stopRes.status !== 304) {
|
||||
return res.status(500).json({
|
||||
error: 'Failed to stop container',
|
||||
details: stopRes.data,
|
||||
});
|
||||
}
|
||||
|
||||
// Remove container
|
||||
// Remove container — 204 = removed, 404 = already gone (both acceptable)
|
||||
const removeRes = await dockerApi(
|
||||
'DELETE',
|
||||
`/containers/${recorder.container_id}`
|
||||
);
|
||||
|
||||
if (removeRes.status !== 204) {
|
||||
if (removeRes.status !== 204 && removeRes.status !== 404) {
|
||||
return res.status(500).json({
|
||||
error: 'Failed to remove container',
|
||||
details: removeRes.data,
|
||||
|
|
|
|||
Loading…
Reference in a new issue