Reporting: Handle timeouts in rendering (#20415)
* Added timeout in grpc call to plugins for rendering
This commit is contained in:
@@ -3,12 +3,11 @@ package rendering
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
plugin "github.com/hashicorp/go-plugin"
|
||||
|
||||
pluginModel "github.com/grafana/grafana-plugin-model/go/renderer"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
@@ -93,10 +92,20 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (rs *RenderingService) RenderErrorImage(err error) (*RenderResult, error) {
|
||||
imgUrl := "public/img/rendering_error.png"
|
||||
|
||||
return &RenderResult{
|
||||
FilePath: filepath.Join(setting.HomePath, imgUrl),
|
||||
KeepFileAfterRender: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResult, error) {
|
||||
if rs.inProgressCount > opts.ConcurrentLimit {
|
||||
return &RenderResult{
|
||||
FilePath: filepath.Join(setting.HomePath, "public/img/rendering_limit.png"),
|
||||
FilePath: filepath.Join(setting.HomePath, "public/img/rendering_limit.png"),
|
||||
KeepFileAfterRender: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user