Commit 1b38d945 by Jon Gyllenswärd Committed by GitHub

Image-rendering: Cleanup of rendering code (#20496)

parent 432f3602
...@@ -26,8 +26,7 @@ type Opts struct { ...@@ -26,8 +26,7 @@ type Opts struct {
} }
type RenderResult struct { type RenderResult struct {
FilePath string FilePath string
KeepFileAfterRender bool
} }
type renderFunc func(ctx context.Context, options Opts) (*RenderResult, error) type renderFunc func(ctx context.Context, options Opts) (*RenderResult, error)
......
...@@ -96,16 +96,14 @@ func (rs *RenderingService) RenderErrorImage(err error) (*RenderResult, error) { ...@@ -96,16 +96,14 @@ func (rs *RenderingService) RenderErrorImage(err error) (*RenderResult, error) {
imgUrl := "public/img/rendering_error.png" imgUrl := "public/img/rendering_error.png"
return &RenderResult{ return &RenderResult{
FilePath: filepath.Join(setting.HomePath, imgUrl), FilePath: filepath.Join(setting.HomePath, imgUrl),
KeepFileAfterRender: true,
}, nil }, nil
} }
func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResult, error) { func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResult, error) {
if rs.inProgressCount > opts.ConcurrentLimit { if rs.inProgressCount > opts.ConcurrentLimit {
return &RenderResult{ 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 }, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment