Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: reset available count when canceling Analysis Task #643

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ public void loadAttachments(Task task) {
task.setAppFile(appFile);
break;
case StorageFileInfo.FileType.TEST_APP_FILE:
if (!(task instanceof TestTask)) {
return;
}
File testAppFile = downloadFile(attachment);
Assert.isTrue(testAppFile != null && testAppFile.exists() && task instanceof TestTask, "Download test app file failed!");
Assert.isTrue(testAppFile != null && testAppFile.exists(), "Download test app file failed!");
((TestTask) task).setTestAppFile(testAppFile);
break;
case StorageFileInfo.FileType.T2C_JSON_FILE:
if (!(task instanceof TestTask)) {
return;
}
File testJsonFile = downloadFile(attachment);
Assert.isTrue(testJsonFile != null && testJsonFile.exists() && task instanceof TestTask, "Download test json file failed!");
Assert.isTrue(testJsonFile != null && testJsonFile.exists(), "Download test json file failed!");
((TestTask) task).addTestJsonFile(testJsonFile);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,17 @@ public void updateAccessInfo(AccessInfo accessInfo) {

public void cancelTestTaskById(String taskId, String reason) {
Set<String> agentIds = testDataService.cancelTaskById(taskId, reason);
Task task = testDataService.getTaskDetail(taskId);
JSONObject data = new JSONObject();
Message message = new Message();
data.put(Const.AgentConfig.TASK_ID_PARAM, taskId);
message.setPath(Const.Path.TEST_TASK_CANCEL);
message.setBody(data);
for (String agentId : agentIds) {
if (Task.RunnerType.APK_SCANNER.name().equals(task.getRunnerType())) {
agentDeviceGroups.get(agentId).finishAnalysisTask(task.getRunnerType());
}

AgentSessionInfo agentSession = getAgentSessionInfoByAgentId(agentId);
if (agentSession == null || agentSession.session == null) {
continue;
Expand Down