Refactor to use LuaJIT and improve performance
Integrate LuaJIT as an optional runtime for better performance, with a fallback to standard Lua 5.4. Update Dockerfile to install LuaJIT and create a wrapper script for execution. Enhance network module with socket fallback support and update README to reflect these changes and configuration options.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
-- Ollama service management module for auto-boot-ollama-host
|
||||
-- Handles starting, stopping, and monitoring Ollama service
|
||||
|
||||
local socket = require("socket")
|
||||
local utils = require("utils")
|
||||
local network = require("network")
|
||||
local ssh = require("ssh")
|
||||
@@ -11,7 +10,7 @@ local ollama_manager = {}
|
||||
-- Start Ollama service via SSH
|
||||
function ollama_manager.start_service(config)
|
||||
utils.log("SSH is reachable. Starting Ollama service...")
|
||||
socket.sleep(10)
|
||||
utils.sleep(10)
|
||||
|
||||
-- Start ollama service using nssm
|
||||
ssh.execute("nssm start ollama", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE)
|
||||
@@ -23,7 +22,7 @@ function ollama_manager.start_service(config)
|
||||
-- Wait for service to become available
|
||||
if network.port_is_up(config.OLLAMA_HOST, config.OLLAMA_PORT, 90) then
|
||||
utils.log("Ollama service is reachable again.")
|
||||
socket.sleep(30)
|
||||
utils.sleep(30)
|
||||
return true
|
||||
else
|
||||
utils.log("Timeout waiting for Ollama service to come up after SSH command.")
|
||||
@@ -44,7 +43,7 @@ function ollama_manager.stop_service_and_shutdown(config)
|
||||
|
||||
-- Shutdown the host
|
||||
ssh.execute("shutdown.exe /s /t 0", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE)
|
||||
socket.sleep(5)
|
||||
utils.sleep(5)
|
||||
end
|
||||
|
||||
return ollama_manager
|
||||
|
||||
Reference in New Issue
Block a user