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

This commit is contained in:
Jon Gyllenswärd 2019-11-20 09:26:59 +01:00 committed by GitHub
parent 432f36024b
commit 1b38d94537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -26,8 +26,7 @@ type Opts struct {
}
type RenderResult struct {
FilePath string
KeepFileAfterRender bool
FilePath string
}
type renderFunc func(ctx context.Context, options Opts) (*RenderResult, error)

View File

@ -96,16 +96,14 @@ func (rs *RenderingService) RenderErrorImage(err error) (*RenderResult, error) {
imgUrl := "public/img/rendering_error.png"
return &RenderResult{
FilePath: filepath.Join(setting.HomePath, imgUrl),
KeepFileAfterRender: true,
FilePath: filepath.Join(setting.HomePath, imgUrl),
}, 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"),
KeepFileAfterRender: true,
FilePath: filepath.Join(setting.HomePath, "public/img/rendering_limit.png"),
}, nil
}