use ctx with cancel to (hopefully) avoid deadlocks

This commit is contained in:
stefanodvx 2025-04-15 17:51:06 +02:00
parent 8d972ff74b
commit 1a27103347
6 changed files with 50 additions and 30 deletions

View file

@ -34,6 +34,7 @@ func InlineDownloadHandler(
})
return nil
}
return core.HandleInline(bot, ctx, dlCtx)
}
@ -56,7 +57,14 @@ func InlineDownloadResultHandler(
)
defer cancel()
taskCtx, cancel := context.WithTimeout(
context.Background(),
5*time.Minute,
)
defer cancel()
go core.GetInlineFormat(
taskCtx,
bot, ctx, dlCtx,
mediaChan, errChan,
)