Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,16 @@ def test_shutdown_allows_1_export_to_finish(self, batch_processor_class, telemet
processor._batch_processor.emit(telemetry)
processor._batch_processor.emit(telemetry)
processor._batch_processor.emit(telemetry)
before = time.time()
before = time.monotonic()
processor._batch_processor.shutdown(timeout_millis=3000)
# Shutdown does not kill the thread.
assert processor._batch_processor._worker_thread.is_alive() is True

after = time.time()
after = time.monotonic()
assert after - before < 3.3
# Thread will naturally finish after a little bit.
time.sleep(0.1)

# The exporter shutdown interrupts the in-progress export. Depending
# on thread scheduling, the worker may stop before or shortly after
# shutdown() returns.
processor._batch_processor._worker_thread.join(timeout=1)
assert processor._batch_processor._worker_thread.is_alive() is False
# Expect the second call to be interrupted by shutdown, and the third call to never be made.
assert exporter.sleep_interrupted is True
Expand Down
Loading