Skip to content

Commit

Permalink
Fix bug on jobId not being sent in transfer start/terminated messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartcaunt committed Jan 5, 2024
1 parent 4742d01 commit 57e06ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@illgrenoble/visa-print-server",
"version": "1.1.2",
"version": "1.1.3",
"description": "A print server to transfer print jobs from a VISA instance to a print client via websocket",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions src/gateways/printer.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export class PrinterGateway implements OnGatewayInit, OnGatewayConnection, OnGat
client.broadcast.emit('print_job_handled', jobId);
}

async sendChunkedPrinterJob(printJobs: PrintJob[]): Promise<void> {
await this.emit('print_job_start');
async sendChunkedPrinterJob(jobId: number, printJobs: PrintJob[]): Promise<void> {
await this.emit('print_job_start', jobId);

for (const printJob of printJobs) {
await this.sendPrinterJob(printJob);
}

await this.emit('print_job_end');
await this.emit('print_job_end', jobId);
}

async sendPrinterJob(printJob: PrintJob): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/services/printer-job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class PrinterJobService {
try {
this.logger.log(`Transferring ${chunks.length} chunks for print job ${jobId} (file '${fileData.fileName}' of length ${fileData.length} bytes)`);

await this.printerGateway.sendChunkedPrinterJob(chunks);
await this.printerGateway.sendChunkedPrinterJob(jobId, chunks);

this.logger.log(`Print job ${jobId} transferred successfully`);
} catch (error) {
Expand Down

0 comments on commit 57e06ba

Please sign in to comment.