Merge branch 'develop' into feat-1714
This commit is contained in:
commit
8754ca6fd7
118 changed files with 7642 additions and 466 deletions
|
|
@ -7,3 +7,13 @@ export async function tick(): Promise<void> {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/misskey-dev/misskey/issues/11267
|
||||
*/
|
||||
export function semaphore(counter = 0, waiting: (() => void)[] = []) {
|
||||
return {
|
||||
acquire: () => ++counter > 1 && new Promise<void>(resolve => waiting.push(resolve)),
|
||||
release: () => --counter && waiting.pop()?.(),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue