Better termination handling in Scanner's progress

This commit is contained in:
Deluan
2020-11-25 19:05:36 -05:00
parent 3ad36ebd2a
commit f29bb211d1
3 changed files with 36 additions and 31 deletions
+4 -3
View File
@@ -39,7 +39,8 @@ func (c *LibraryScanningController) GetScanStatus(w http.ResponseWriter, r *http
}
func (c *LibraryScanningController) StartScan(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
loggedUser, ok := request.UserFrom(r.Context())
ctx := r.Context()
loggedUser, ok := request.UserFrom(ctx)
if !ok {
return nil, newError(responses.ErrorGeneric, "Internal error")
}
@@ -51,9 +52,9 @@ func (c *LibraryScanningController) StartScan(w http.ResponseWriter, r *http.Req
fullScan := utils.ParamBool(r, "fullScan", false)
go func() {
err := c.scanner.RescanAll(fullScan)
err := c.scanner.RescanAll(ctx, fullScan)
if err != nil {
log.Error(r.Context(), err)
log.Error(ctx, err)
}
}()