Changed setting to be an alerting setting
This commit is contained in:
@@ -13,16 +13,16 @@ var ErrNoRenderer = errors.New("No renderer plugin found nor is an external rend
|
||||
var ErrPhantomJSNotInstalled = errors.New("PhantomJS executable not found")
|
||||
|
||||
type Opts struct {
|
||||
Width int
|
||||
Height int
|
||||
Timeout time.Duration
|
||||
OrgId int64
|
||||
UserId int64
|
||||
OrgRole models.RoleType
|
||||
Path string
|
||||
Encoding string
|
||||
Timezone string
|
||||
IsAlert bool
|
||||
Width int
|
||||
Height int
|
||||
Timeout time.Duration
|
||||
OrgId int64
|
||||
UserId int64
|
||||
OrgRole models.RoleType
|
||||
Path string
|
||||
Encoding string
|
||||
Timezone string
|
||||
ConcurrentLimit int
|
||||
}
|
||||
|
||||
type RenderResult struct {
|
||||
|
||||
@@ -90,16 +90,8 @@ func (rs *RenderingService) Run(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (rs *RenderingService) getLimit(isAlerting bool) int {
|
||||
if isAlerting {
|
||||
return rs.Cfg.RendererLimitAlerting
|
||||
} else {
|
||||
return rs.Cfg.RendererLimit
|
||||
}
|
||||
}
|
||||
|
||||
func (rs *RenderingService) Render(ctx context.Context, opts Opts) (*RenderResult, error) {
|
||||
if rs.inProgressCount > rs.getLimit(opts.IsAlert) {
|
||||
if rs.inProgressCount > opts.ConcurrentLimit {
|
||||
return &RenderResult{
|
||||
FilePath: filepath.Join(setting.HomePath, "public/img/rendering_limit.png"),
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user