Skip to content

Commit

Permalink
fix plugin mode
Browse files Browse the repository at this point in the history
  • Loading branch information
AgnesToulet committed Dec 17, 2024
1 parent e13ecad commit 0eff67d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugin/v2/grpc_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ class PluginGRPCServer {
}

async render(call: grpc.ServerUnaryCall<RenderRequest, any>, callback: grpc.sendUnaryData<RenderResponse>) {
const { signal } = new AbortController();
const abortController = new AbortController();
const { signal } = abortController;

const req = call.request;
const headers: HTTPHeaders = {};

Expand Down Expand Up @@ -140,7 +142,12 @@ class PluginGRPCServer {
};

this.log.debug('Render request received', 'url', options.url);
call.on('cancelled', (err) => {
this.log.debug('Connection closed', 'url', options.url, 'error', err);
abortController.abort();
});
let errStr = '';

try {
await this.browser.render(options, signal);
} catch (err) {
Expand All @@ -151,7 +158,8 @@ class PluginGRPCServer {
}

async renderCsv(call: grpc.ServerUnaryCall<RenderCSVRequest, any>, callback: grpc.sendUnaryData<RenderCSVResponse>) {
const { signal } = new AbortController();
const abortController = new AbortController();
const { signal } = abortController;

const req = call.request;
const headers: HTTPHeaders = {};
Expand Down Expand Up @@ -188,6 +196,11 @@ class PluginGRPCServer {
};

this.log.debug('Render request received', 'url', options.url);
call.on('cancelled', (err) => {
this.log.debug('Connection closed', 'url', options.url, 'error', err);
abortController.abort();
});

let errStr = '';
let fileName = '';
try {
Expand Down

0 comments on commit 0eff67d

Please sign in to comment.