Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold: FlowpipeConfig filewatcher #701

Merged
merged 2 commits into from
Feb 22, 2024
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
4 changes: 3 additions & 1 deletion internal/es/db/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ func GetFlowpipeConfig() (*flowpipeconfig.FlowpipeConfig, error) {
flowpipeConfigCached, found := cache.GetCache().Get("#flowpipeconfig")

if !found {
return flowpipeconfig.NewFlowpipeConfig(), nil
// TODO: if we return an error all our "non mod based test" fail
// return nil, perr.BadRequestWithMessage("flowpipe config not found")
return &flowpipeconfig.FlowpipeConfig{}, nil
}

flowpipeConfig, ok := flowpipeConfigCached.(*flowpipeconfig.FlowpipeConfig)
Expand Down
19 changes: 14 additions & 5 deletions internal/service/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,20 @@ func (m *Manager) initializeResources() error {
cache.GetCache().SetWithTTL("#flowpipeconfig", flowpipeConfig, 24*7*52*99*time.Hour)
}

err = m.cacheConfigData()
if err != nil {
return err
}

if m.shouldStartAPI() {
err := flowpipeConfig.SetupWatcher(context.TODO(), func(c context.Context, e error) {

})
if err != nil {
return err
}
}

w, errorAndWarning := workspace.LoadWorkspacePromptingForVariables(
m.ctx,
modLocation,
Expand Down Expand Up @@ -275,11 +289,6 @@ func (m *Manager) initializeResources() error {
return err
}

err = m.cacheConfigData()
if err != nil {
return err
}

slog.Info("Pipelines and triggers loaded", "pipelines", len(pipelines), "triggers", len(triggers), "rootMod", rootModName)

m.RootMod = mod
Expand Down
Loading