perf(消息通知): 优化发送通知的性能
This commit is contained in:
parent
bf0f33f110
commit
038a26a7cc
|
@ -9,7 +9,6 @@ import io.metersphere.notice.service.NoticeSendService;
|
|||
import io.metersphere.service.SystemParameterService;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -25,7 +24,6 @@ public class AfterReturningNoticeSendService {
|
|||
@Resource
|
||||
private NoticeSendService noticeSendService;
|
||||
|
||||
@Async
|
||||
public void sendNotice(SendNotice sendNotice, Object retValue, SessionUser sessionUser, String currentProjectId) {
|
||||
//
|
||||
List<Map> resources = new ArrayList<>();
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package io.metersphere.notice.sender;
|
||||
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
public interface NoticeSender {
|
||||
@Async
|
||||
void send(MessageDetail messageDetail, NoticeModel noticeModel);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.notice.sender.NoticeModel;
|
|||
import io.metersphere.notice.sender.impl.*;
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -59,6 +60,7 @@ public class NoticeSendService {
|
|||
/**
|
||||
* 在线操作发送通知
|
||||
*/
|
||||
@Async
|
||||
public void send(String taskType, NoticeModel noticeModel) {
|
||||
try {
|
||||
String projectId = (String) noticeModel.getParamMap().get("projectId");
|
||||
|
@ -81,6 +83,7 @@ public class NoticeSendService {
|
|||
/**
|
||||
* jenkins 和定时任务触发的发送
|
||||
*/
|
||||
@Async
|
||||
public void send(String triggerMode, String taskType, NoticeModel noticeModel) {
|
||||
// api和定时任务调用不排除自己
|
||||
noticeModel.setExcludeSelf(false);
|
||||
|
@ -119,6 +122,7 @@ public class NoticeSendService {
|
|||
/**
|
||||
* 后台触发的发送,没有session
|
||||
*/
|
||||
@Async
|
||||
public void send(Project project, String taskType, NoticeModel noticeModel) {
|
||||
try {
|
||||
List<MessageDetail> messageDetails;
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
|
|||
import io.metersphere.base.domain.MessageTask;
|
||||
import io.metersphere.base.domain.MessageTaskExample;
|
||||
import io.metersphere.base.mapper.MessageTaskMapper;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -29,8 +28,6 @@ import java.util.stream.Collectors;
|
|||
public class NoticeService {
|
||||
@Resource
|
||||
private MessageTaskMapper messageTaskMapper;
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
public void saveMessageTask(MessageDetail messageDetail) {
|
||||
MessageTaskExample example = new MessageTaskExample();
|
||||
|
|
Loading…
Reference in New Issue