Previews: prevent scheduler from running when image renderer is outdated (#45623)

* #44449: prevent crawler from running when rendering service is outdated

* #44449: simplify
pull/45631/head
Artur Wierzbicki 3 years ago committed by GitHub
parent 7643ae6c5e
commit c04b0179ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      pkg/services/thumbs/crawler.go

@ -3,6 +3,7 @@ package thumbs
import (
"context"
"encoding/json"
"fmt"
"os"
"strings"
"sync"
@ -83,6 +84,16 @@ func (r *simpleCrawler) broadcastStatus() {
}
func (r *simpleCrawler) Run(ctx context.Context, authOpts rendering.AuthOpts, mode CrawlerMode, theme models.Theme, thumbnailKind models.ThumbnailKind) error {
res, err := r.renderService.HasCapability(rendering.ScalingDownImages)
if err != nil {
return err
}
if !res.IsSupported {
return fmt.Errorf("cant run dashboard crawler - rendering service needs to be updated. "+
"current version: %s, requiredVersion: %s", r.renderService.Version(), res.SemverConstraint)
}
r.queueMutex.Lock()
if r.IsRunning() {
r.queueMutex.Unlock()

Loading…
Cancel
Save