mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-07 07:06:54 +08:00
Update src/index.ts
Co-authored-by: Shigma <shigma10826@gmail.com>
This commit is contained in:
parent
a6bd059670
commit
7b2aa62fbe
@ -309,9 +309,11 @@ export function apply(ctx: Context, config: Config) {
|
||||
if (globalTasks.size >= config.globalConcurrency) {
|
||||
const pendingId = container.pop()
|
||||
globalPending.add(pendingId)
|
||||
await new Promise<void>((resolve) => ctx.once('novelai/finish', (id) => {
|
||||
if (id === pendingId) {
|
||||
await new Promise<void>((resolve) => {
|
||||
const dispose = ctx.on('novelai/finish', (id) => {
|
||||
if (id !== pendingId) return
|
||||
resolve()
|
||||
dispose()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user