use ctx with cancel to (hopefully) avoid deadlocks
This commit is contained in:
parent
8d972ff74b
commit
1a27103347
6 changed files with 50 additions and 30 deletions
|
@ -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,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue