Skip to content

Commit

Permalink
fix #336 (#338)
Browse files Browse the repository at this point in the history
* Processing stops with "context canceled" all the time
Fixes #336

* edit release.md
  • Loading branch information
simulot committed Jun 30, 2024
1 parent 3734d17 commit abd793e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cmd/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path"
"path/filepath"
"strings"
"sync/atomic"
"time"

"github.com/gdamore/tcell/v2"
Expand Down Expand Up @@ -349,6 +350,7 @@ func (app *UpCmd) runUI(ctx context.Context) error {
defer cancel(nil)
page := app.newPage()
p := page.Page(ctx)
preparationDone := atomic.Bool{}

uiGroup := errgroup.Group{}

Expand Down Expand Up @@ -380,6 +382,7 @@ func (app *UpCmd) runUI(ctx context.Context) error {
} else {
err = context.Cause(ctx)
}
preparationDone.Store(true)
return err
})

Expand All @@ -392,12 +395,14 @@ func (app *UpCmd) runUI(ctx context.Context) error {
case <-ctx.Done():
return ctx.Err()
case <-tick.C:
now := time.Now().Unix()
last := page.lastTimeServerActive.Load()
if now-last > 10 {
cancel(nil)
p.Stop()
return nil
if preparationDone.Load() {
now := time.Now().Unix()
last := page.lastTimeServerActive.Load()
if now-last > 10 {
cancel(nil)
p.Stop()
return nil
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release notes

## Release 0.18.1

- fix [#336](https://github.com/simulot/immich-go/issues/336) Processing stops with "context canceled" all the time

## Release 0.18
![screen](/docs/render1719696528932.gif)

Expand Down

0 comments on commit abd793e

Please sign in to comment.