mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -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 (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
@ -135,8 +136,8 @@ func (s *ScreenshotImageService) NewImage(ctx context.Context, r *models.AlertRu
|
||||
Timeout: screenshotTimeout,
|
||||
}
|
||||
|
||||
k := fmt.Sprintf("%s-%d-%s", opts.DashboardUID, opts.PanelID, opts.Theme)
|
||||
result, err, _ := s.singleflight.Do(k, func() (interface{}, error) {
|
||||
optsHash := base64.StdEncoding.EncodeToString(opts.Hash())
|
||||
result, err, _ := s.singleflight.Do(optsHash, func() (interface{}, error) {
|
||||
screenshot, err := s.limiter.Do(ctx, opts, s.screenshots.Take)
|
||||
if err != nil {
|
||||
if errors.Is(err, dashboards.ErrDashboardNotFound) {
|
||||
|
Loading…
Reference in New Issue
Block a user