Skip to content

Commit

Permalink
Fix Service Crashes on Multiple Page Scan #806
Browse files Browse the repository at this point in the history
  • Loading branch information
manuc66 committed Nov 29, 2023
1 parent add48f2 commit d2e734b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function adfAutoscanCmd(
tempFolder,
adfAutoScanConfig,
deviceCapabilities,
new Date()
new Date(),
);
} catch (e) {
console.log(e);
Expand Down
14 changes: 6 additions & 8 deletions src/scanProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ async function executeScanJob(
scanCount: number,
scanJobContent: ScanContent,
filePattern: string | undefined,
date: Date,
): Promise<"Completed" | "Canceled"> {
const jobUrl = await HPApi.postJob(scanJobSettings);

Expand All @@ -176,7 +175,7 @@ async function executeScanJob(
scanCount,
scanJobContent.elements.length + 1,
filePattern,
date,
new Date(),
);
job = await HPApi.getJob(jobUrl);
if (page != null && job.jobState != "Canceled") {
Expand Down Expand Up @@ -230,7 +229,6 @@ async function executeScanJobs(
firstEvent: Event,
deviceCapabilities: DeviceCapabilities,
filePattern: string | undefined,
date: Date,
) {
let jobState = await executeScanJob(
scanJobSettings,
Expand All @@ -239,7 +237,6 @@ async function executeScanJobs(
scanCount,
scanJobContent,
filePattern,
date,
);
let lastEvent = firstEvent;
if (
Expand All @@ -265,7 +262,6 @@ async function executeScanJobs(
scanCount,
scanJobContent,
filePattern,
new Date(),
);
if (jobState !== "Completed") {
return;
Expand Down Expand Up @@ -473,7 +469,6 @@ export async function saveScan(
event,
deviceCapabilities,
scanConfig.directoryConfig.filePattern,
scanDate,
);

console.log(
Expand Down Expand Up @@ -533,7 +528,11 @@ export async function scanFromAdf(
destinationFolder = folder;
}

const scanWidth = getScanWidth(adfAutoScanConfig, InputSource.Adf, deviceCapabilities);
const scanWidth = getScanWidth(
adfAutoScanConfig,
InputSource.Adf,
deviceCapabilities,
);
const scanHeight = getScanHeight(
adfAutoScanConfig,
InputSource.Adf,
Expand All @@ -558,7 +557,6 @@ export async function scanFromAdf(
scanCount,
scanJobContent,
adfAutoScanConfig.directoryConfig.filePattern,
date,
);

console.log(
Expand Down
2 changes: 1 addition & 1 deletion test/PathHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const now: Date = new Date();
describe("PathHelper", () => {
describe("getFileForPage", () => {
it("Can format a file with formatted timestamp", async () => {
const nextFileName = PathHelper.getFileForPage(
const nextFileName = PathHelper.getFileForPage(
"someFolder",
2,
1,
Expand Down

0 comments on commit d2e734b

Please sign in to comment.