Skip to content

Commit

Permalink
add sleep 500ms if platform is windows (janhq#1215)
Browse files Browse the repository at this point in the history
Co-authored-by: Hien To <[email protected]>
  • Loading branch information
hiento09 and hientominh authored Dec 26, 2023
1 parent 1682f89 commit d4b4540
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions extensions/inference-nitro-extension/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ async function loadModel(nitroResourceProbe: any | undefined) {
if (!nitroResourceProbe) nitroResourceProbe = await getResourcesInfo();
return killSubprocess()
.then(() => tcpPortUsed.waitUntilFree(PORT, 300, 5000))
// wait for 500ms to make sure the port is free for windows platform
.then(() => {
if (process.platform === "win32") {
return sleep(500);
}
else {
return sleep(0);
}
})
.then(() => spawnNitroProcess(nitroResourceProbe))
.then(() => loadLLMModel(currentSettings))
.then(validateModelStatus)
Expand All @@ -78,6 +87,11 @@ async function loadModel(nitroResourceProbe: any | undefined) {
});
}

// Add function sleep
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}

function promptTemplateConverter(promptTemplate) {
// Split the string using the markers
const systemMarker = "{system_message}";
Expand Down

0 comments on commit d4b4540

Please sign in to comment.