Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
201d853f
Commit
201d853f
authored
May 22, 2024
by
Michael Yang
Browse files
nolintlint
parent
e40145a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
+27
-16
cmd/cmd.go
cmd/cmd.go
+0
-16
cmd/start.go
cmd/start.go
+27
-0
No files found.
cmd/cmd.go
View file @
201d853f
...
@@ -1029,22 +1029,6 @@ func initializeKeypair() error {
...
@@ -1029,22 +1029,6 @@ func initializeKeypair() error {
return
nil
return
nil
}
}
func
waitForServer
(
ctx
context
.
Context
,
client
*
api
.
Client
)
error
{
// wait for the server to start
timeout
:=
time
.
After
(
5
*
time
.
Second
)
tick
:=
time
.
Tick
(
500
*
time
.
Millisecond
)
for
{
select
{
case
<-
timeout
:
return
errors
.
New
(
"timed out waiting for server to start"
)
case
<-
tick
:
if
err
:=
client
.
Heartbeat
(
ctx
);
err
==
nil
{
return
nil
// server has started
}
}
}
}
func
checkServerHeartbeat
(
cmd
*
cobra
.
Command
,
_
[]
string
)
error
{
func
checkServerHeartbeat
(
cmd
*
cobra
.
Command
,
_
[]
string
)
error
{
client
,
err
:=
api
.
ClientFromEnvironment
()
client
,
err
:=
api
.
ClientFromEnvironment
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
cmd/start.go
0 → 100644
View file @
201d853f
//go:build darwin || windows
package
cmd
import
(
"context"
"errors"
"time"
"github.com/ollama/ollama/api"
)
func
waitForServer
(
ctx
context
.
Context
,
client
*
api
.
Client
)
error
{
// wait for the server to start
timeout
:=
time
.
After
(
5
*
time
.
Second
)
tick
:=
time
.
Tick
(
500
*
time
.
Millisecond
)
for
{
select
{
case
<-
timeout
:
return
errors
.
New
(
"timed out waiting for server to start"
)
case
<-
tick
:
if
err
:=
client
.
Heartbeat
(
ctx
);
err
==
nil
{
return
nil
// server has started
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment