-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve continuous export failure recovery by moving the export operation "progress marker" from USB drive to VxScan store #4213
Changes from 4 commits
74a6434
0cf1243
bf80f78
131953a
a9caa14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,10 @@ export class Store { | |
private readonly uiStringsStore: UiStringsStore | ||
) {} | ||
|
||
// Used by shared CVR export logic in libs/backend | ||
// eslint-disable-next-line vx/gts-no-public-class-fields | ||
readonly scannerType = 'precinct'; | ||
|
||
getDbPath(): string { | ||
return this.client.getDatabasePath(); | ||
} | ||
|
@@ -823,15 +827,44 @@ export class Store { | |
return safeParseSystemSettings(result.data).unsafeUnwrap(); | ||
} | ||
|
||
isContinuousExportOperationInProgress(): boolean { | ||
const row = this.client.one( | ||
` | ||
select | ||
is_continuous_export_operation_in_progress as isContinuousExportOperationInProgress | ||
from is_continuous_export_operation_in_progress | ||
` | ||
) as { isContinuousExportOperationInProgress: number } | undefined; | ||
return Boolean(row?.isContinuousExportOperationInProgress); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just added a type + basic utils to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh nice! Can move to a shared location There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ a9caa14 |
||
} | ||
|
||
setIsContinuousExportOperationInProgress( | ||
isContinuousExportOperationInProgress: boolean | ||
): void { | ||
this.client.run('delete from is_continuous_export_operation_in_progress'); | ||
this.client.run( | ||
` | ||
insert into is_continuous_export_operation_in_progress ( | ||
is_continuous_export_operation_in_progress | ||
) values (?) | ||
`, | ||
isContinuousExportOperationInProgress ? 1 : 0 | ||
); | ||
} | ||
|
||
/** | ||
* Gets the name of the directory that we're continuously exporting to, e.g. | ||
* TEST__machine_SCAN-0001__2023-08-16_17-02-24. Returns undefined if not yet set. | ||
*/ | ||
getExportDirectoryName(): string | undefined { | ||
const result = this.client.one( | ||
'select export_directory_name as exportDirectoryName from export_directory_name' | ||
const row = this.client.one( | ||
` | ||
select | ||
export_directory_name as exportDirectoryName | ||
from export_directory_name | ||
` | ||
) as { exportDirectoryName: string } | undefined; | ||
return result?.exportDirectoryName; | ||
return row?.exportDirectoryName; | ||
} | ||
|
||
/** | ||
|
@@ -840,7 +873,11 @@ export class Store { | |
setExportDirectoryName(exportDirectoryName: string): void { | ||
this.client.run('delete from export_directory_name'); | ||
this.client.run( | ||
'insert into export_directory_name (export_directory_name) values (?)', | ||
` | ||
insert into export_directory_name ( | ||
export_directory_name | ||
) values (?) | ||
`, | ||
exportDirectoryName | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually implement this store method in the next commit