Skip to content

Commit

Permalink
Merge pull request #2996 from aduffeck/fix-loading-shares
Browse files Browse the repository at this point in the history
Do not close share dump channels
  • Loading branch information
aduffeck authored Jun 21, 2022
2 parents 5d799b6 + 103572f commit d90c8aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-loading-shares2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Do not close share dump channels

We no longer close the channels when dumping shares, it's the responsibility of the caller.

https://github.com/cs3org/reva/pull/2996
3 changes: 0 additions & 3 deletions pkg/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ func (m *mgr) Dump(ctx context.Context, shareChan chan<- *collaboration.Share, r
}
}

close(shareChan)
close(receivedShareChan)

return nil
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/share/manager/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ var _ = Describe("Json", func() {
}()
err := m.(share.DumpableManager).Dump(ctx, sharesChan, receivedChan)
Expect(err).ToNot(HaveOccurred())
close(sharesChan)
close(receivedChan)
wg.Wait()
Eventually(sharesChan).Should(BeClosed())
Eventually(receivedChan).Should(BeClosed())

Expect(len(shares)).To(Equal(1))
Expect(shares[0].Creator).To(Equal(user1.Id))
Expand All @@ -157,15 +157,15 @@ var _ = Describe("Json", func() {
shares = append(shares, rs)
}
}

wg.Done()
}()
err := m.(share.DumpableManager).Dump(ctx, sharesChan, receivedChan)
Expect(err).ToNot(HaveOccurred())
close(sharesChan)
close(receivedChan)
wg.Wait()

Eventually(sharesChan).Should(BeClosed())
Eventually(receivedChan).Should(BeClosed())

Expect(len(shares)).To(Equal(1))
Expect(shares[0].UserID).To(Equal(user2.Id))
Expect(shares[0].ReceivedShare.State).To(Equal(collaboration.ShareState_SHARE_STATE_ACCEPTED))
Expand Down

0 comments on commit d90c8aa

Please sign in to comment.