Open eh-am opened 1 year ago
This is going to be tricky.
When stopping the profiler, it only sets up a stop flag https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L284 Which only affects the next profiling round https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L257-L264
That means that it may take up to 10 seconds (the profiling round) to exit https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204
This behaviour is pretty clear when running tests, where the test runner hangs up to 10 seconds, and the last profile captured is full of idle, since the program it's not doing anything.
idle
This is going to be tricky.
When stopping the profiler, it only sets up a stop flag https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L284 Which only affects the next profiling round https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L257-L264
That means that it may take up to 10 seconds (the profiling round) to exit https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204
This behaviour is pretty clear when running tests, where the test runner hangs up to 10 seconds, and the last profile captured is full of
idle
, since the program it's not doing anything.