-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Ensured that a scanned file returning something different than true or false will be retried later. - Investigate on what is returned during a virus scan failed and check if there is difference between null and undefined in the response and a way to capture the error thrown. - Created interface `VirusScanCode` to ensure expected behavior from method `scanFile`. - Added key `isServerAvailable` to the response for queue method `performVirusScan`. - Updated the virus-scan queue configuration as below (suggested 12 attempts every 30min). ```json { "retry": 12, "cleanUpPeriod": 604800000, "retryInterval": 900000, "dashboardReadonly": false } ``` - Removed the NotFound exception as it is not related to HTTP. - Made sure that error is thrown. - Added E2E Test(s) to ensure that exception is thrown when the scanning process does not complete. ![image](https://github.com/user-attachments/assets/87e6c425-b1da-4d40-bf34-182d259f8420) **Step Not in AC** (Discussion) - Set `virus_scan_status` to `VirusScanStatus.Pending` for error handling and null response and include `VirusScanStatus.Pending` in the where clause for getting a student file. Screenshot of log messages for server unavailable during file scanning in queue-consumers ![image](https://github.com/user-attachments/assets/266f2c6e-9f06-4f8d-875c-f1edf7eb9cde) Screenshot of log messages in bull dashboard ![image](https://github.com/user-attachments/assets/4d544e65-08b8-457f-910b-e34623eed735) **Rollback Evidence** ![image](https://github.com/user-attachments/assets/5f8c38a4-8fdc-49e4-817d-72e0fe73c25a)
- Loading branch information
1 parent
4e3b55a
commit 77a5f14
Showing
10 changed files
with
291 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,6 +235,8 @@ services: | |
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
networks: | ||
- local-network | ||
# - ClamAV | ||
# Web | ||
web: | ||
|
21 changes: 21 additions & 0 deletions
21
...kend/apps/db-migrations/src/migrations/1724108928803-UpdateVirusScanQueueConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
import { getSQLFileData } from "../utilities/sqlLoader"; | ||
|
||
export class UpdateVirusScanQueueConfiguration1724108928803 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData("Update-virus-scan-queue-configuration.sql", "Queue"), | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
getSQLFileData( | ||
"Rollback-update-virus-scan-queue-configuration.sql", | ||
"Queue", | ||
), | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ckend/apps/db-migrations/src/sql/Queue/Rollback-update-virus-scan-queue-configuration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
UPDATE | ||
sims.queue_configurations | ||
SET | ||
queue_configuration = '{ | ||
"retry": 3, | ||
"retryInterval": 180000, | ||
"dashboardReadonly": false, | ||
"cleanUpPeriod": 604800000 | ||
}' :: json | ||
WHERE | ||
queue_name = 'virus-scan'; |
11 changes: 11 additions & 0 deletions
11
...ckages/backend/apps/db-migrations/src/sql/Queue/Update-virus-scan-queue-configuration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
UPDATE | ||
sims.queue_configurations | ||
SET | ||
queue_configuration = '{ | ||
"retry": 12, | ||
"retryInterval": 900000, | ||
"dashboardReadonly": false, | ||
"cleanUpPeriod": 604800000 | ||
}' :: json | ||
WHERE | ||
queue_name = 'virus-scan'; |
8 changes: 6 additions & 2 deletions
8
sources/packages/backend/apps/queue-consumers/src/constants/error-code.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
// Error code used when file virus scanning failed for some reason. | ||
// Error codes used when file virus scanning failed for some reason. | ||
// One possible reason could be the ClamAV server being down. | ||
export const UNABLE_TO_SCAN_FILE = "UNABLE_TO_SCAN_FILE"; | ||
export const CONNECTION_FAILED = "CONNECTION_FAILED"; | ||
export const FILE_NOT_FOUND = "FILE_NOT_FOUND"; | ||
export const FILE_SCANNING_FAILED = "FILE_SCANNING_FAILED"; | ||
export const SERVER_UNAVAILABLE = "SERVER_UNAVAILABLE"; | ||
export const UNKNOWN_ERROR = "UNKNOWN_ERROR"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.