@@ -38,43 +38,47 @@ export default class ReportBackendStorageController implements Disposable {
38
38
const batchSize = 99
39
39
for ( let i = 0 ; i < projectReportPaths . length ; i += batchSize ) {
40
40
const batchFiles = projectReportPaths . slice ( i , i + batchSize )
41
- const hashes = await Promise . all ( batchFiles . map ( async ( filePath ) => {
41
+ const hashes = ( await Promise . all ( batchFiles . map ( async ( filePath ) => {
42
42
const unifiedFilePath = new UnifiedPath ( filePath )
43
43
const reportPath = WorkspaceUtils . getWorkspaceDir ( ) ?. join ( unifiedFilePath )
44
44
if ( ! reportPath ) {
45
- return undefined
45
+ return
46
46
}
47
47
48
48
let projectReport
49
49
try {
50
50
projectReport = ProjectReport . loadFromFile ( reportPath , 'bin' )
51
51
} catch ( e ) {
52
- return undefined
52
+ return
53
+ }
54
+ const hash = ProjectReport . hashFromBinFile ( reportPath )
55
+ if ( this . isHashChecked ( hash , url ) ) {
56
+ return
53
57
}
54
-
55
58
const shouldBeStored = await projectReport ?. shouldBeStoredInRegistry ( )
56
59
if ( projectReport === undefined || ! shouldBeStored ) {
57
- return undefined
60
+ return
58
61
}
59
62
60
- return ProjectReport . hashFromBinFile ( reportPath )
63
+ return hash
61
64
62
- } ) )
65
+ } ) ) ) . filter ( hash => hash !== undefined )
63
66
64
- const uncheckedHashes = hashes . filter ( hash => ! this . isHashChecked ( hash , url ) )
65
- if ( uncheckedHashes . length === 0 ) {
67
+ if ( hashes . length === 0 ) {
66
68
continue
67
69
}
68
70
69
- const urlWithHashes = `http:/${ url } /check-existence?` + uncheckedHashes . map ( hash => `hashes[]=${ hash } ` ) . join ( '&' )
71
+
72
+ const urlWithHashes = `http:/${ url } /check-existence?` + hashes . map ( hash => `hashes[]=${ hash } ` ) . join ( '&' )
73
+ console . log ( urlWithHashes )
70
74
const response = await fetch ( urlWithHashes )
71
75
if ( ! response . ok ) {
72
76
console . debug ( 'check-existence Failed!' , response . status )
73
77
continue
74
78
}
75
79
76
80
const data = await response . json ( )
77
- for ( const hash of uncheckedHashes ) {
81
+ for ( const hash of hashes ) {
78
82
if ( hash && ! data [ hash ] ) {
79
83
const filePath = batchFiles [ hashes . indexOf ( hash ) ]
80
84
const unifiedFilePath = new UnifiedPath ( filePath )
0 commit comments