Skip to content

Commit 7777583

Browse files
authored
fix(livestream): stop all channels before pool update to avoid FAILED_PRECONDITION (GoogleCloudPlatform#4312)
* fix(livestream): stop all channels before pool update to avoid FAILED_PRECONDITION * fix(livestream): scope channel cleanup to test prefix to avoid FAILED_PRECONDITION
1 parent 24f3fb5 commit 7777583

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

media/livestream/test/livestream.test.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ before(async () => {
5353
parent: livestreamServiceClient.locationPath(projectId, location),
5454
});
5555
for (const channel of channels) {
56-
if (channel.createTime.seconds < DATE_NOW_SEC - THREE_HOURS_IN_SEC) {
56+
const isTestChannel = channel.name.includes(
57+
'nodejs-test-livestream-channel'
58+
);
59+
if (isTestChannel) {
5760
const request = {
5861
name: channel.name,
5962
};
@@ -68,16 +71,18 @@ before(async () => {
6871
console.log(err);
6972
}
7073

71-
const [events] = await livestreamServiceClient.listEvents({
72-
parent: channel.name,
73-
});
74-
75-
for (const event of events) {
76-
await livestreamServiceClient.deleteEvent({
77-
name: event.name,
74+
if (channel.createTime.seconds < DATE_NOW_SEC - THREE_HOURS_IN_SEC) {
75+
const [events] = await livestreamServiceClient.listEvents({
76+
parent: channel.name,
7877
});
78+
79+
for (const event of events) {
80+
await livestreamServiceClient.deleteEvent({
81+
name: event.name,
82+
});
83+
}
84+
await livestreamServiceClient.deleteChannel(request);
7985
}
80-
await livestreamServiceClient.deleteChannel(request);
8186
}
8287
}
8388

0 commit comments

Comments
 (0)