@@ -7,7 +7,7 @@ const { sendData } = require('./send-data')
7
7
const dc = require ( '../../../diagnostics_channel' )
8
8
const { fileURLToPath } = require ( 'url' )
9
9
10
- const savedDependencies = new Set ( )
10
+ const savedDependenciesToSend = new Set ( )
11
11
const detectedDependencyKeys = new Set ( )
12
12
const detectedDependencyVersions = new Set ( )
13
13
@@ -20,14 +20,14 @@ function waitAndSend (config, application, host) {
20
20
if ( ! immediate ) {
21
21
immediate = setImmediate ( ( ) => {
22
22
immediate = null
23
- if ( savedDependencies . size > 0 ) {
24
- const dependencies = Array . from ( savedDependencies . values ( ) ) . splice ( 0 , 1000 ) . map ( pair => {
25
- savedDependencies . delete ( pair )
23
+ if ( savedDependenciesToSend . size > 0 ) {
24
+ const dependencies = Array . from ( savedDependenciesToSend . values ( ) ) . splice ( 0 , 1000 ) . map ( pair => {
25
+ savedDependenciesToSend . delete ( pair )
26
26
const [ name , version ] = pair . split ( ' ' )
27
27
return { name, version }
28
28
} )
29
29
sendData ( config , application , host , 'app-dependencies-loaded' , { dependencies } )
30
- if ( savedDependencies . size > 0 ) {
30
+ if ( savedDependenciesToSend . size > 0 ) {
31
31
waitAndSend ( config , application , host )
32
32
}
33
33
}
@@ -61,7 +61,7 @@ function onModuleLoad (data) {
61
61
const dependencyAndVersion = `${ name } ${ version } `
62
62
63
63
if ( ! detectedDependencyVersions . has ( dependencyAndVersion ) ) {
64
- savedDependencies . add ( dependencyAndVersion )
64
+ savedDependenciesToSend . add ( dependencyAndVersion )
65
65
detectedDependencyVersions . add ( dependencyAndVersion )
66
66
67
67
waitAndSend ( config , application , host )
@@ -100,7 +100,7 @@ function stop () {
100
100
application = null
101
101
host = null
102
102
detectedDependencyKeys . clear ( )
103
- savedDependencies . clear ( )
103
+ savedDependenciesToSend . clear ( )
104
104
detectedDependencyVersions . clear ( )
105
105
if ( moduleLoadStartChannel . hasSubscribers ) {
106
106
moduleLoadStartChannel . unsubscribe ( onModuleLoad )
0 commit comments