File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ import {
1818 Telemetry ,
1919} from '../transmitter/types' ;
2020import { IPullableImage , IScanImage } from './images/types' ;
21- import { getWorkloadAlreadyScanned } from '../state' ;
21+ import {
22+ getWorkloadAlreadyScanned ,
23+ getWorkloadImageAlreadyScanned ,
24+ } from '../state' ;
2225
2326export async function processWorkload (
2427 workloadMetadata : IWorkload [ ] ,
@@ -131,8 +134,12 @@ async function scanImagesAndSendResults(
131134
132135 // All workloads are identical, pick the first one
133136 const workload = workloadMetadata [ 0 ] ;
134- const state = await getWorkloadAlreadyScanned ( workload ) ;
135- if ( state === undefined ) {
137+ const workloadState = await getWorkloadAlreadyScanned ( workload ) ;
138+ const imageState = await getWorkloadImageAlreadyScanned (
139+ workload ,
140+ workload . imageId ,
141+ ) ;
142+ if ( workloadState === undefined && imageState === undefined ) {
136143 logger . info (
137144 { workloadName } ,
138145 'the workload has been deleted while scanning was in progress, skipping sending scan results' ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import * as LruCache from 'lru-cache';
33
44import { config } from './common/config' ;
55
6- const imagesLruCacheOptions = {
6+ const imagesLruCacheOptions : LruCache . Options < string , string > = {
77 // limit cache size so we don't exceed memory limit
88 max : config . IMAGES_SCANNED_CACHE . MAX_SIZE ,
99 // limit cache life so if our backend loses track of an image's data,
@@ -12,7 +12,7 @@ const imagesLruCacheOptions = {
1212 updateAgeOnGet : false ,
1313} ;
1414
15- const workloadsLruCacheOptions = {
15+ const workloadsLruCacheOptions : LruCache . Options < string , string > = {
1616 // limit cache size so we don't exceed memory limit
1717 max : config . WORKLOADS_SCANNED_CACHE . MAX_SIZE ,
1818 // limit cache life so if our backend loses track of an image's data,
You can’t perform that action at this time.
0 commit comments