diff --git a/src/main/java/run/halo/app/controller/admin/api/ThemeController.java b/src/main/java/run/halo/app/controller/admin/api/ThemeController.java index 340551adc..04d57ff35 100644 --- a/src/main/java/run/halo/app/controller/admin/api/ThemeController.java +++ b/src/main/java/run/halo/app/controller/admin/api/ThemeController.java @@ -5,6 +5,7 @@ import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import run.halo.app.annotation.DisableOnCondition; +import run.halo.app.cache.lock.CacheLock; import run.halo.app.handler.theme.config.support.Group; import run.halo.app.handler.theme.config.support.ThemeProperty; import run.halo.app.model.params.ThemeContentParam; @@ -144,6 +145,7 @@ public class ThemeController { @PostMapping("{themeId}/settings") @ApiOperation("Saves theme settings") + @CacheLock(prefix = "save_theme_setting_by_themeId") public void saveSettingsBy(@PathVariable("themeId") String themeId, @RequestBody Map settings) { themeSettingService.save(settings, themeId); diff --git a/src/main/java/run/halo/app/service/impl/ThemeSettingServiceImpl.java b/src/main/java/run/halo/app/service/impl/ThemeSettingServiceImpl.java index 93fc0a295..33c909a0f 100644 --- a/src/main/java/run/halo/app/service/impl/ThemeSettingServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/ThemeSettingServiceImpl.java @@ -4,6 +4,7 @@ import freemarker.template.Configuration; import freemarker.template.TemplateModelException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.data.domain.Example; import org.springframework.lang.NonNull; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -87,7 +88,10 @@ public class ThemeSettingServiceImpl extends AbstractCrudService