close llm on interrupt (#577)

This commit is contained in:
Bruce MacDonald 2023-09-22 19:41:52 +01:00 committed by GitHub
parent 9df31c3518
commit 5d71bda478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -570,6 +570,9 @@ func Serve(ln net.Listener, allowOrigins []string) error {
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-signals
if loaded.llm != nil {
loaded.llm.Close()
}
os.RemoveAll(workDir)
os.Exit(0)
}()