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

fix: dashboard cache (sequence of actions) #835

Merged
merged 1 commit into from Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions controllers/grafanadashboard/dashboard_pipeline.go
Expand Up @@ -35,9 +35,7 @@ const (
SourceTypeUnknown SourceType = 3
)

var (
grafanaComDashboardApiUrlRoot string = "https://grafana.com/api/dashboards"
)
var grafanaComDashboardApiUrlRoot string = "https://grafana.com/api/dashboards"

type DashboardPipeline interface {
ProcessDashboard(knownHash string, folderId *int64, folderName string, forceRecreate bool) ([]byte, error)
Expand Down Expand Up @@ -304,13 +302,13 @@ func (r *DashboardPipelineImpl) loadDashboardFromURL(source string) error {
return err
}

r.refreshDashboard()
r.Dashboard.Status = v1alpha1.GrafanaDashboardStatus{
ContentCache: content,
ContentTimestamp: &metav1.Time{Time: time.Now()},
ContentUrl: source,
}

r.refreshDashboard()
if err := r.Client.Status().Update(r.Context, r.Dashboard); err != nil {
if !k8serrors.IsConflict(err) {
return fmt.Errorf("failed to update status with content for dashboard %s/%s: %w", r.Dashboard.Namespace, r.Dashboard.Name, err)
Expand Down