Skip to content

Commit

Permalink
fix: pending id error
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan committed Aug 15, 2024
1 parent 572a2fa commit a6bd059
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ export function apply(ctx: Context, config: Config) {
: session.text('.waiting'))

if (config.globalConcurrency) {
while (globalTasks.size >= config.globalConcurrency) {
globalPending.add(container.pop())
if (globalTasks.size >= config.globalConcurrency) {
const pendingId = container.pop()
globalPending.add(pendingId)
await new Promise<void>((resolve) => ctx.once('novelai/finish', (id) => {
if (id === id) {
if (id === pendingId) {
resolve()
}
}))
Expand Down

0 comments on commit a6bd059

Please sign in to comment.