Skip to content

Commit

Permalink
bug fix: SQLite并发写入问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohann0617 committed Dec 21, 2024
1 parent cbc8920 commit c67808a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public String login(LoginParams params) {
@Transactional(rollbackFor = Exception.class)
public void updateSysCfg(UpdateSysCfgParams params) {
kvService.remove(new LambdaQueryWrapper<OciKv>().eq(OciKv::getType, SysCfgTypeEnum.SYS_INIT_CFG.getCode()));
kvService.saveBatch(SysCfgEnum.getCodeListByType(SysCfgTypeEnum.SYS_INIT_CFG).parallelStream()
kvService.saveBatch(SysCfgEnum.getCodeListByType(SysCfgTypeEnum.SYS_INIT_CFG).stream()
.map(x -> {
OciKv ociKv = new OciKv();
ociKv.setId(IdUtil.getSnowflakeNextIdStr());
Expand Down Expand Up @@ -306,7 +306,7 @@ private String getCfgValue(SysCfgEnum sysCfgEnum) {

private void cleanAndRestartTask() {
Optional.ofNullable(createTaskService.list())
.filter(CollectionUtil::isNotEmpty).orElseGet(Collections::emptyList).parallelStream()
.filter(CollectionUtil::isNotEmpty).orElseGet(Collections::emptyList).stream()
.forEach(task -> {
if (task.getCreateNumbers() <= 0) {
createTaskService.removeById(task.getId());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/yohann/ocihelper/task/OciTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void cleanLogTask() {

private void cleanAndRestartTask() {
Optional.ofNullable(createTaskService.list())
.filter(CollectionUtil::isNotEmpty).orElseGet(Collections::emptyList).parallelStream()
.filter(CollectionUtil::isNotEmpty).orElseGet(Collections::emptyList).stream()
.forEach(task -> {
if (task.getCreateNumbers() <= 0) {
createTaskService.removeById(task.getId());
Expand Down

0 comments on commit c67808a

Please sign in to comment.