Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/eckit/io/DblBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/


#include "eckit/config/Resource.h"
#include "eckit/io/DblBuffer.h"
#include "eckit/io/AutoCloser.h"
#include "eckit/io/Buffer.h"
Expand Down Expand Up @@ -99,6 +100,9 @@ Length DblBuffer::copy(DataHandle& in, DataHandle& out) {
Length total = estimate;
Length copied = 0;

static Resource<long> maxRetriesResource("dblBufferMaxRetries", 5);
long maxRetries = maxRetriesResource;

bool more = true;
while (more) {
more = false;
Expand All @@ -115,8 +119,14 @@ Length DblBuffer::copy(DataHandle& in, DataHandle& out) {
}
}
catch (RestartTransfer& retry) {
if (maxRetries-- <= 0) {
Log::error() << "DblBuffer::copy() failed after maximum retries" << std::endl;
throw DblBufferError("Maximum retry attempts reached");
}

Log::warning() << "Retrying transfer from " << retry.from() << " (" << Bytes(retry.from()) << ")"
<< std::endl;
watcher_.restartFrom(retry.from());
in.restartReadFrom(retry.from());
out.restartWriteFrom(retry.from());
estimate = total - retry.from();
Expand Down
6 changes: 6 additions & 0 deletions src/eckit/io/MoverTransfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ Length MoverTransfer::transfer(DataHandle& from, DataHandle& to) {
else if (pos == -2) {
watcher_.toHandleOpened();
}
else if (pos == -3) {
Offset from;
s >> from;
watcher_.restartFrom(from);
progress(from);
}
s >> more;
}

Expand Down
Loading