Skip to content

Commit

Permalink
fixed locked remote loader
Browse files Browse the repository at this point in the history
This could be the last one!

Signed-off-by: quobix <dave@quobix.com>
  • Loading branch information
daveshanley committed Feb 7, 2024
1 parent 9db2900 commit 561396d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index/rolodex_remote_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) {
}

if remoteParsedURL.Scheme == "" {
processingWaiter.done = true
i.ProcessingFiles.Delete(remoteParsedURL.Path)
return nil, nil // not a remote file, nothing wrong with that - just we can't keep looking here partner.
}
Expand All @@ -362,6 +363,7 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) {

i.remoteErrors = append(i.remoteErrors, clientErr)
// remove from processing
processingWaiter.done = true
i.ProcessingFiles.Delete(remoteParsedURL.Path)
if response != nil {
i.logger.Error("client error", "error", clientErr, "status", response.StatusCode)
Expand All @@ -372,14 +374,15 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) {
}
if response == nil {
// remove from processing
processingWaiter.done = true
i.ProcessingFiles.Delete(remoteParsedURL.Path)

return nil, fmt.Errorf("empty response from remote URL: %s", remoteParsedURL.String())
}
responseBytes, readError := io.ReadAll(response.Body)
if readError != nil {

// remove from processing
processingWaiter.done = true
i.ProcessingFiles.Delete(remoteParsedURL.Path)

return nil, fmt.Errorf("error reading bytes from remote file '%s': [%s]",
Expand All @@ -389,6 +392,7 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) {
if response.StatusCode >= 400 {

// remove from processing
processingWaiter.done = true
i.ProcessingFiles.Delete(remoteParsedURL.Path)

i.logger.Error("unable to fetch remote document",
Expand Down

0 comments on commit 561396d

Please sign in to comment.