Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dropbox: correctly limit longpoll to dir
  • Loading branch information
frioux committed Jan 10, 2021
1 parent aecb3e4 commit a9e275e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/dropbox/longpoll.go
Expand Up @@ -9,6 +9,7 @@ import (

// Longpoll signals changes in dir by sending on ch.
func (db Client) Longpoll(ctx context.Context, dir string, ch chan<- struct{}) {
OUTER:
for {
res, err := db.ListFolder(ListFolderParams{
Path: dir,
Expand Down Expand Up @@ -42,6 +43,16 @@ func (db Client) Longpoll(ctx context.Context, dir string, ch chan<- struct{}) {
continue
}

ch <- struct{}{}
res = ListFolderResult{HasMore: true, Cursor: cu}
res, err = db.ListFolderContinue(res.Cursor)
if err != nil {
fmt.Fprintln(os.Stderr, "ListFolderContinue:", err)
continue
}

if len(res.Entries) > 0 {
ch <- struct{}{}
}
continue OUTER
}
}

0 comments on commit a9e275e

Please sign in to comment.