feat: Automatically recover from frozen live streams (#2569)

- Closes: #2099
This commit is contained in:
Dermot Duffy
2026-07-07 21:37:24 -07:00
committed by GitHub
parent 9f956fe89f
commit fb1bbc739e
73 changed files with 3321 additions and 364 deletions
+33 -1
View File
@@ -29,6 +29,38 @@ describe('Initializer', () => {
expect(initializer.isInitialized('foo')).toBeTruthy();
});
it('should not initialize when the initializer reports failure', async () => {
const initializer = new Initializer();
expect(await initializer.initializeIfNecessary('foo', async () => false)).toBe(
false,
);
expect(initializer.isInitialized('foo')).toBeFalsy();
expect(await initializer.initializeIfNecessary('foo', async () => true)).toBe(true);
expect(initializer.isInitialized('foo')).toBeTruthy();
});
it('should report whether all of multiple aspects initialized', async () => {
const initializer = new Initializer();
expect(
await initializer.initializeMultipleIfNecessary({
foo: async () => false,
bar: async () => {},
}),
).toBe(false);
expect(initializer.isInitialized('foo')).toBeFalsy();
expect(initializer.isInitialized('bar')).toBeTruthy();
expect(
await initializer.initializeMultipleIfNecessary({
foo: async () => true,
}),
).toBe(true);
expect(initializer.isInitialized('foo')).toBeTruthy();
});
it('should not initialize with failed initializer', async () => {
const initializer = new Initializer();
@@ -89,7 +121,7 @@ describe('Initializer', () => {
initializer.uninitialize('foo');
finishInitializer();
await initializing;
expect(await initializing).toBe(false);
expect(initializer.isInitialized('foo')).toBeFalsy();
});