perf:操作日志实时插入
This commit is contained in:
@@ -23,7 +23,6 @@ import com.tiesheng.web.util.ProcessSyncConsumer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,11 +31,6 @@ import java.util.List;
|
||||
@Service
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||
|
||||
/**
|
||||
* 日志缓存
|
||||
*/
|
||||
private static final List<CoreLogOperation> cacheOperations = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
@@ -180,14 +174,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
if (params != null) {
|
||||
operation.setParams(JSON.toJSONString(params));
|
||||
}
|
||||
|
||||
synchronized (CoreLogOperation.class) {
|
||||
cacheOperations.add(operation);
|
||||
if (cacheOperations.size() >= 100) {
|
||||
getBaseMapper().batchInsert(cacheOperations);
|
||||
cacheOperations.clear();
|
||||
}
|
||||
}
|
||||
save(operation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user