Skip to content

Commit

Permalink
add clamp of 2 minutes
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Lee <[email protected]>
  • Loading branch information
dave-gray101 committed Sep 16, 2024
1 parent 79d507a commit d2d6fa0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/model/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ var knownModelsNameSuffixToSkip []string = []string{
".tar.gz",
}

const retryTimeout = time.Duration(2 * time.Minute)

func (ml *ModelLoader) ListFilesInModelPath() ([]string, error) {
files, err := os.ReadDir(ml.ModelPath)
if err != nil {
Expand Down Expand Up @@ -154,7 +156,11 @@ func (ml *ModelLoader) ShutdownModel(modelName string) error {
retries := 1
for ml.models[modelName].GRPC(false, ml.wd).IsBusy() {
log.Debug().Msgf("%s busy. Waiting.", modelName)
time.Sleep(time.Duration(retries * 2) * time.Second)
dur := time.Duration(retries*2) * time.Second
if dur > retryTimeout {
dur = retryTimeout
}
time.Sleep(dur)
retries++
}

Expand Down

0 comments on commit d2d6fa0

Please sign in to comment.