Skip to content

Commit

Permalink
nolintlint
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed Jun 4, 2024
1 parent e40145a commit 201d853
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
16 changes: 0 additions & 16 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,22 +1029,6 @@ func initializeKeypair() error {
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 {
client, err := api.ClientFromEnvironment()
if err != nil {
Expand Down
27 changes: 27 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//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
}
}
}
}

0 comments on commit 201d853

Please sign in to comment.