Skip to content

Commit

Permalink
fix race condition in downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Mar 19, 2024
1 parent cf084c0 commit d730bf6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,9 @@ var ErrNotStarted = errors.New("downloader not started")
// filesystem.
func (c *Client) DownloadFile(dir string, f slack.File) (string, error) {
c.mu.Lock()
started := c.started
c.mu.Unlock()
defer c.mu.Unlock()

if !started {
if !c.started {
return "", ErrNotStarted
}
c.fileRequests <- fileRequest{Directory: dir, File: &f}
Expand Down

0 comments on commit d730bf6

Please sign in to comment.