RabbitMQ delay retry with Dead Letter Exchange

https://github.com/chrislusf/seaweedfs/issues/1773

https://github.com/google/go-cloud/issues/2952
This commit is contained in:
Konstantin Lebedev
2021-02-03 21:32:30 +05:00
parent a331bbb3ae
commit 24ec17219b
5 changed files with 335 additions and 20 deletions

View File

@@ -17,9 +17,10 @@ func CopyFromChunkViews(chunkViews []*filer.ChunkView, filerSource *source.Filer
}
var writeErr error
var shouldRetry bool
for _, fileUrl := range fileUrls {
_, err = util.ReadUrlAsStream(fileUrl+"?readDeleted=true", nil, false, chunk.IsFullChunk(), chunk.Offset, int(chunk.Size), func(data []byte) {
shouldRetry, err = util.ReadUrlAsStream(fileUrl+"?readDeleted=true", nil, false, chunk.IsFullChunk(), chunk.Offset, int(chunk.Size), func(data []byte) {
writeErr = writeFunc(data)
})
if err != nil {
@@ -30,11 +31,12 @@ func CopyFromChunkViews(chunkViews []*filer.ChunkView, filerSource *source.Filer
break
}
}
if err != nil {
if shouldRetry && err != nil {
return err
}
if writeErr != nil {
return writeErr
}
}
return nil
}