Skip to content

Commit

Permalink
fix: Missing notification of bgtask cancellation or failure when shut…
Browse files Browse the repository at this point in the history
…ting down the server (#2579) (#2960)

Co-authored-by: Gyubong Lee <jopemachine@naver.com>
Co-authored-by: Joongi Kim <joongi@lablup.com>
  • Loading branch information
3 people authored Oct 24, 2024
1 parent d75f5c4 commit f68d98f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/2579.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missing notification of cancellation or failure of background tasks when shutting down the server
6 changes: 5 additions & 1 deletion src/ai/backend/common/bgtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ async def push_bgtask_events(
else:
await resp.send("{}", event="bgtask_done")
await resp.send("{}", event="server_close")
case BgtaskCancelledEvent() | BgtaskFailedEvent():
case BgtaskCancelledEvent():
await resp.send(json.dumps(body), event="bgtask_cancelled")
await resp.send("{}", event="server_close")
case BgtaskFailedEvent():
await resp.send(json.dumps(body), event="bgtask_failed")
await resp.send("{}", event="server_close")
except:
log.exception("")
Expand Down

0 comments on commit f68d98f

Please sign in to comment.