Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions apps/jan-api-gateway/application/app/domain/cron/cron_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,19 @@ import (
"context"

"github.com/mileusna/crontab"
inference_model_registry "menlo.ai/jan-api-gateway/app/domain/inference_model_registry"
janinference "menlo.ai/jan-api-gateway/app/utils/httpclients/jan_inference"
"menlo.ai/jan-api-gateway/config/environment_variables"
)

type CronService struct {
JanInferenceClient *janinference.JanInferenceClient
InferenceModelRegistry *inference_model_registry.InferenceModelRegistry
}

func NewService(janInferenceClient *janinference.JanInferenceClient, registry *inference_model_registry.InferenceModelRegistry) *CronService {
return &CronService{
JanInferenceClient: janInferenceClient,
InferenceModelRegistry: registry,
}
func NewCronService() *CronService {
return &CronService{}
}

func (cs *CronService) Start(ctx context.Context, ctab *crontab.Crontab) {
// Run initial check
cs.InferenceModelRegistry.CheckInferenceModels(ctx)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove cache support in this version for clean PR.
So no need to reload models frequently, let call it directly.


ctab.AddJob("* * * * *", func() {
cs.InferenceModelRegistry.CheckInferenceModels(ctx)

// Reload environment variables
environment_variables.EnvironmentVariables.LoadFromEnv()
})
}

This file was deleted.

This file was deleted.

Loading
Loading