fix, не учитывалась настройка оповещения. оповещалось безусловно

This commit is contained in:
2023-12-21 18:16:14 +03:00
parent dbc05900ba
commit 52ce1e78aa
2 changed files with 48 additions and 52 deletions

View File

@@ -66,11 +66,13 @@ public abstract class TestingPlanner<P extends TestingPackage> {
ServerCommand(ServerCode.EditObject, testingPackage);
}
void EmailPackage() throws Exception {
EmailMessage message = new EmailMessage();
message.subject = "Состояние пакета задач " + Utils.Brackets(testingPackage) + " изменилось на " + Utils.Brackets(testingPackage.state.getDescription());
message.text = testingPackage.description;
message.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message);
if (testingPackage.needsEmail == 1) {
EmailMessage message = new EmailMessage();
message.subject = "Состояние пакета задач " + Utils.Brackets(testingPackage) + " изменилось на " + Utils.Brackets(testingPackage.state.getDescription());
message.text = testingPackage.description;
message.targets.add(testingPackage.sender_address);
ServerCommand(ServerCode.Email, message);
}
}
//---
protected abstract ServerCode getActivePackageCode();
@@ -122,48 +124,49 @@ public abstract class TestingPlanner<P extends TestingPackage> {
}
// ---
public void Perform() {
try {
testingPackage = null;
testingPackage = (P) ServerCommand(getActivePackageCode());
if (testingPackage != null) {
Print(testingPackage.id + ":" + testingPackage.state.getDescription());
//--
InitSessionCredentials();
if (testingPackage.state.equals(TasksPackageState.Analysis)) {
AnalyseResults();
UpdatePackageState(TasksPackageState.Done);
EmailPackage();
} else {
try {
if (Connect()) {
int ptk_id = (int) ServerCommand(getCheckIfNeedsKillCode(), testingPackage.id);
if (ptk_id!= Constants.Nan) {
Print("package " + testingPackage.id + " NEEDS TO KILL");
Kill();
UpdatePackageState(TasksPackageState.Aborted);
EmailPackage();
ServerCommand(ServerCode.DeleteObjectByPK, ptk_id);
} else {
Session();
}
try {
testingPackage = null;
testingPackage = (P) ServerCommand(getActivePackageCode());
if (testingPackage != null) {
Print(testingPackage.id + ":" + testingPackage.state.getDescription());
//--
InitSessionCredentials();
if (testingPackage.state.equals(TasksPackageState.Analysis)) {
AnalyseResults();
UpdatePackageState(TasksPackageState.Done);
EmailPackage();
} else {
try {
if (Connect()) {
int ptk_id = (int) ServerCommand(getCheckIfNeedsKillCode(), testingPackage.id);
if (ptk_id != Constants.Nan) {
Print("package " + testingPackage.id + " NEEDS TO KILL");
Kill();
UpdatePackageState(TasksPackageState.Aborted);
EmailPackage();
ServerCommand(ServerCode.DeleteObjectByPK, ptk_id);
} else {
Session();
}
} catch (Exception ex) {
Print("Ошибка сеанса. Соединение будет разорвано.");
Print(ex.getMessage());
Disconnect();
} finally {}
}
} catch (Exception ex) {
Print("Ошибка сеанса. Соединение будет разорвано.");
Print(ex.getMessage());
Disconnect();
} finally {
}
//--
testingPackage.destructor();
testingPackage = null;
System.gc();
//--
}
//else Print(this.getClass().getSimpleName()+": no active package found");
} catch (Exception ex) {
ex.printStackTrace();
} finally {
Utils.sleep(getSleepMillis());
//--
testingPackage.destructor();
testingPackage = null;
System.gc();
//--
}
//else Print(this.getClass().getSimpleName()+": no active package found");
} catch (Exception ex) {
ex.printStackTrace();
} finally {
Utils.sleep(getSleepMillis());
}
}
}