-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feature/bai 1461 manual rerequest filescanning #1633
Feature/bai 1461 manual rerequest filescanning #1633
Conversation
…, additional properties such as lastRanAt and scannerVersion
if (!file) { | ||
throw BadReq('Cannot find requested file', { modelId: modelId, fileId: fileId }) | ||
} | ||
const auth = await authorisation.model(user, model, ModelAction.Update) |
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.
Could we add a FileAction.Update?
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.
Don't forget to add tests for this new route.
@@ -152,3 +156,28 @@ export async function getTotalFileSize(fileIds: string[]) { | |||
}) | |||
return totalSize.at(0).totalSize | |||
} | |||
|
|||
export async function rerunFileScan(user: UserInterface, modelId, fileId: string) { |
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.
To prevent the scanners being overloaded, we could first check if a scan is already underway?
@@ -152,3 +156,28 @@ export async function getTotalFileSize(fileIds: string[]) { | |||
}) | |||
return totalSize.at(0).totalSize | |||
} | |||
|
|||
export async function rerunFileScan(user: UserInterface, modelId, fileId: string) { |
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.
Test this new function.
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.
As mentioned in the ticket, this might require a migration as files that existing prior to adding the ability to scan them might be missing the avScan
property. Could you check this please?
Does migration 009 not cover this use case? |
Test what happens when a scanner is killed off part way through a scan - we want to be able to catch this and update the scan result to "could not complete" rather than indefinitely reporting "virus scan in progress". |
|
||
let av: NodeClam | ||
export const clamAvToolName = 'Clam AV' | ||
const maxInitRetries = 5 |
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'd like the max retry count maxInitRetries = 5
and delay between pings 10000
to be configurable like retryDelayInMinutes
e.g. connectors.fileScanners.maxInitRetries
and connectors.fileScanners.initRetryDelay
.
@@ -113,8 +113,8 @@ describe('clients > modelScan', () => { | |||
) | |||
}) | |||
|
|||
test('scanStream > rejected', async () => { | |||
fetchMock.default.mockRejectedValueOnce('Unable to communicate with the inferencing service.') | |||
test('scanFile > rejected', async () => { |
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.
Revert scanFile
to scanStream
…est name of modelscan
No description provided.