mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Use hash of opts in singleflight (#58474)
This commit is contained in:
parent
72275e97d2
commit
ad9ac85ee0
@ -2,6 +2,7 @@ package image
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
@ -135,8 +136,8 @@ func (s *ScreenshotImageService) NewImage(ctx context.Context, r *models.AlertRu
|
|||||||
Timeout: screenshotTimeout,
|
Timeout: screenshotTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
k := fmt.Sprintf("%s-%d-%s", opts.DashboardUID, opts.PanelID, opts.Theme)
|
optsHash := base64.StdEncoding.EncodeToString(opts.Hash())
|
||||||
result, err, _ := s.singleflight.Do(k, func() (interface{}, error) {
|
result, err, _ := s.singleflight.Do(optsHash, func() (interface{}, error) {
|
||||||
screenshot, err := s.limiter.Do(ctx, opts, s.screenshots.Take)
|
screenshot, err := s.limiter.Do(ctx, opts, s.screenshots.Take)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, dashboards.ErrDashboardNotFound) {
|
if errors.Is(err, dashboards.ErrDashboardNotFound) {
|
||||||
|
Loading…
Reference in New Issue
Block a user