Skip to content

Commit

Permalink
fix(ddc): Throw RpcError if the upload stream closed by the node (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
skambalin authored Oct 2, 2024
1 parent 1b5e810 commit b6ccce1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/ddc/src/FileApi/FileApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export class FileApi {

const call = this.api.putRawPiece({ meta });

await call.requests.send({
/**
* Send none-blocking request message.
*/
call.requests.send({
body: {
oneofKind: 'metadata',
metadata: { ...metadata, size },
Expand All @@ -185,9 +188,12 @@ export class FileApi {
break;
}

await call.requests.send({
body: { oneofKind: 'content', content: { data: value } },
});
await Promise.race([
call.status,
call.requests.send({
body: { oneofKind: 'content', content: { data: value } },
}),
]);

bytesSent += value.byteLength;
}
Expand Down Expand Up @@ -250,9 +256,9 @@ export class FileApi {
const call = this.api.getFile({ meta });

/**
* Send request message.
* Send none-blocking request message.
*/
await call.requests.send({
call.requests.send({
body: {
oneofKind: 'request',
request: { ...request, authenticate },
Expand Down

0 comments on commit b6ccce1

Please sign in to comment.