fix #1088 add thumbnail.generator.interval

This commit is contained in:
Shinsuke Sugaya 2017-06-04 18:32:45 +09:00
parent c84ebd0f45
commit c417f23e6d
3 changed files with 32 additions and 0 deletions

View file

@ -768,6 +768,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. png */
String THUMBNAIL_HTML_IMAGE_FORMAT = "thumbnail.html.image.format";
/** The key of the configuration. e.g. 0 */
String THUMBNAIL_GENERATOR_INTERVAL = "thumbnail.generator.interval";
/** The key of the configuration. e.g. all */
String THUMBNAIL_GENERATOR_TARGETS = "thumbnail.generator.targets";
@ -3771,6 +3774,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
String getThumbnailHtmlImageFormat();
/**
* Get the value for the key 'thumbnail.generator.interval'. <br>
* The value is, e.g. 0 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getThumbnailGeneratorInterval();
/**
* Get the value for the key 'thumbnail.generator.interval' as {@link Integer}. <br>
* The value is, e.g. 0 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getThumbnailGeneratorIntervalAsInteger();
/**
* Get the value for the key 'thumbnail.generator.targets'. <br>
* The value is, e.g. all <br>
@ -6353,6 +6371,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return get(FessConfig.THUMBNAIL_HTML_IMAGE_FORMAT);
}
public String getThumbnailGeneratorInterval() {
return get(FessConfig.THUMBNAIL_GENERATOR_INTERVAL);
}
public Integer getThumbnailGeneratorIntervalAsInteger() {
return getAsInteger(FessConfig.THUMBNAIL_GENERATOR_INTERVAL);
}
public String getThumbnailGeneratorTargets() {
return get(FessConfig.THUMBNAIL_GENERATOR_TARGETS);
}

View file

@ -211,6 +211,11 @@ public class ThumbnailManager {
}
if (!generator.generate(entity.getThumbnailId(), entity.getUrl(), outputFile)) {
new File(outputFile.getAbsolutePath() + NOIMAGE_FILE_SUFFIX).setLastModified(System.currentTimeMillis());
} else {
long interval = fessConfig.getThumbnailGeneratorIntervalAsInteger().longValue();
if (interval > 0) {
Thread.sleep(interval);
}
}
} else if (logger.isDebugEnabled()) {
logger.debug("No image file exists: " + noImageFile.getAbsolutePath());

View file

@ -392,6 +392,7 @@ thumbnail.html.image.window.height=800
thumbnail.html.image.thumbnail.width=100
thumbnail.html.image.thumbnail.height=100
thumbnail.html.image.format=png
thumbnail.generator.interval=0
thumbnail.generator.targets=all
thumbnail.crawler.enabled=true