Skip to content

Commit 207dbb2

Browse files
committed
Fix stream update not persisting
1 parent ae1255d commit 207dbb2

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

backend/internal/stream.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ const internalStream = {
3434
data.meta = {};
3535
}
3636

37-
let data_no_domains = structuredClone(data);
38-
3937
// streams aren't routed by ___domain name so don't store ___domain names in the DB
38+
let data_no_domains = structuredClone(data);
4039
delete data_no_domains.domain_names;
4140

4241
return streamModel
@@ -72,7 +71,7 @@ const internalStream = {
7271
// Configure nginx
7372
return internalNginx.configure(streamModel, 'stream', row)
7473
.then(() => {
75-
return internalStream.get(access, {id: row.id, expand: ['owner']});
74+
return row;
7675
});
7776
})
7877
.then((row) => {
@@ -139,12 +138,6 @@ const internalStream = {
139138
.query()
140139
.patchAndFetchById(row.id, data)
141140
.then(utils.omitRow(omissions()))
142-
.then((saved_row) => {
143-
return internalNginx.configure(streamModel, 'stream', saved_row)
144-
.then(() => {
145-
return internalStream.get(access, {id: row.id, expand: ['owner']});
146-
});
147-
})
148141
.then((saved_row) => {
149142
// Add to audit log
150143
return internalAuditLog.add(access, {
@@ -157,6 +150,17 @@ const internalStream = {
157150
return saved_row;
158151
});
159152
});
153+
})
154+
.then(() => {
155+
return internalStream.get(access, {id: data.id, expand: ['owner', 'certificate']})
156+
.then((row) => {
157+
return internalNginx.configure(streamModel, 'stream', row)
158+
.then((new_meta) => {
159+
row.meta = new_meta;
160+
row = internalHost.cleanRowCertificateMeta(row);
161+
return _.omit(row, omissions());
162+
});
163+
});
160164
});
161165
},
162166

0 commit comments

Comments
 (0)