Unverified Commit ba8e1e5d authored by boojack's avatar boojack Committed by GitHub

chore: add available generator amount flag (#1696)

parent 467f9080
......@@ -501,12 +501,22 @@ func replacePathTemplate(path string, filename string) string {
return path
}
var availableGeneratorAmount = 32
func getOrGenerateThumbnailImage(srcBlob []byte, dstPath string) ([]byte, error) {
if _, err := os.Stat(dstPath); err != nil {
if !errors.Is(err, os.ErrNotExist) {
return nil, errors.Wrap(err, "failed to check thumbnail image stat")
}
if availableGeneratorAmount <= 0 {
return nil, errors.New("not enough available generator amount")
}
availableGeneratorAmount--
defer func() {
availableGeneratorAmount++
}()
reader := bytes.NewReader(srcBlob)
src, err := imaging.Decode(reader)
if err != 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