Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: terminate tokenizer workers before freeing them from memory (#8925)

Steffen Schmitz3cbe3bd1bcb3
diff --git a/worker/src/utils/shutdown.ts b/worker/src/utils/shutdown.ts
index e9b9a18662..646eab9984 100644
--- a/worker/src/utils/shutdown.ts
+++ b/worker/src/utils/shutdown.ts
@@ -37,9 +37,6 @@ export const onShutdown: NodeJS.SignalsListener = async (signal) => {
// Shutdown clickhouse connections
await ClickHouseClientManager.getInstance().closeAllConnections();
- freeAllTokenizers();
- logger.info("All tokenizers are cleaned up from memory.");
-
// Shutdown tokenization worker threads
try {
await getTokenCountWorkerManager().terminate();
@@ -48,5 +45,8 @@ export const onShutdown: NodeJS.SignalsListener = async (signal) => {
logger.error("Error terminating token count worker threads", error);
}
+ freeAllTokenizers();
+ logger.info("All tokenizers are cleaned up from memory.");
+
logger.info("Shutdown complete, exiting process...");
};