-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
898 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
### 心跳 | ||
websocket底层基于TCP,是可靠连接,协议层有keepAlive机制来保障连接的可靠性。但是应用层依旧需要有心跳机制。 | ||
|
||
a) 是保障服务端可以正常响应客户端的请求。对于服务端cpu或内存过高,可能协议层依旧是连接状态,但是服务端实际无法响应客户端请求。 | ||
|
||
b) 存在一种场景,客户端断开连接后,服务端长时间无法感知,客户端也不知道自身依旧断连,此时如果有心跳机制,可以第一时间发现断连问题。 | ||
|
||
心跳从客户端还是服务端发起? | ||
|
||
网上暂无定论。待讨论。早期的Agiletc是从服务端发起的,当前采用的双向ping的方案。 | ||
|
||
![image](https://dpubstatic.udache.com/static/dpubimg/9960809b-c0e0-4cb3-8b46-73c9c311c851.png) | ||
|
||
### 编辑 | ||
|
||
![image](https://dpubstatic.udache.com/static/dpubimg/2735bfbd-972f-4b5a-a6cb-2b4913a7bb32.png) | ||
|
||
### 保存 | ||
刷新或者退出页面,会触发保存。此时的保存场景整体分成2种,1.最后一个编辑者退出,触发的保存;2.非最后一个编辑者退出,触发的保存。 而保存会触发http的保存和ws onclose中的保存逻辑,根据时序的差异,又会有2种场景。2种保存场景都需要考虑时序问题。 | ||
|
||
- 最后一个编辑者退出,触发的保存 | ||
|
||
http保存会落库,并备份到backup表。 | ||
|
||
onclose中的保存会比较数据库中内容和待保存的case content,比较其中的版本号(base值),如果case content版本号更大,则保存,否则不保存。 | ||
|
||
- 非最后一个编辑者退出,触发的保存 | ||
|
||
http保存中,比较待保存内容与ws实例中的case content,如果没有差异,则将用例内容落库,并备份到backup表。如果有差异,则计算差异,并且以待保存内容为准,更新ws实例中的case content。并将差异发送给其他客户端。 | ||
|
||
onclose保存不做保存动作,仅移除player。 | ||
|
||
### websocket实例关系图 | ||
![image](https://dpubstatic.udache.com/static/dpubimg/ea03cf9a-1b85-4276-b4f4-01e959e688e3.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
case-server/src/main/java/com/xiaoju/framework/entity/request/dir/DirMoveReq.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.xiaoju.framework.entity.request.dir; | ||
|
||
import com.xiaoju.framework.constants.BizConstant; | ||
import com.xiaoju.framework.entity.request.ParamValidate; | ||
import lombok.Data; | ||
import org.springframework.util.StringUtils; | ||
|
||
/** | ||
* 目录下用例全部迁移的请求体 | ||
* Created by didi on 2021/12/14. | ||
*/ | ||
@Data | ||
public class DirMoveReq implements ParamValidate { | ||
private Integer channel; | ||
|
||
private Long productLineId; | ||
|
||
/** | ||
* 被选中文件夹的id | ||
*/ | ||
private String fromId; | ||
|
||
/** | ||
* 如果想移到同级,设置为选中文件夹的parentId | ||
* 如果想要移到自己,设为选中文件夹的Id | ||
*/ | ||
private String toId; | ||
|
||
@Override | ||
public void validate() { | ||
if (productLineId == null || productLineId <= 0) { | ||
throw new IllegalArgumentException("业务线id为空或者非法"); | ||
} | ||
if (StringUtils.isEmpty(fromId) || StringUtils.isEmpty(toId)) { | ||
throw new IllegalArgumentException("来源或迁移文件夹id不能为空"); | ||
} | ||
if (BizConstant.ROOT_BIZ_ID.equals(fromId)) { | ||
throw new IllegalArgumentException("根文件夹暂不支持迁移"); | ||
} | ||
if (fromId.equals(toId)) { | ||
throw new IllegalArgumentException("相同的文件夹不需要迁移"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.