Compare commits

...

2 Commits

Author SHA1 Message Date
Jacob Schmidt
aad36ddd8d Return bank existence lookup errors to callers
- Make `bank_exists` surface backend/UID resolution failures instead of returning `false`
- Add SQF guard to log and alert on unexpected existence responses
- Prevent duplicate/default bank records after failed lookups
2026-05-21 22:39:22 -05:00
Jacob Schmidt
788ac6da7a Throttle mission generation and quiet status logs
- Add a mission generation cooldown in the mission manager
- Suppress noisy task status extension logs
- Switch task and entity class hashes to merged base copies
2026-05-21 21:56:50 -05:00
20 changed files with 68 additions and 53 deletions

1
.gitignore vendored
View File

@ -36,3 +36,4 @@ Thumbs.db
arma/ui/map-viewer/ arma/ui/map-viewer/
arma/server/surrealdb/forge.db/ arma/server/surrealdb/forge.db/
promo/ promo/
arma/forge_pmc_simulator.Tanoa/

View File

@ -328,6 +328,11 @@ GVAR(BankBaseStore) = compileFinal createHashMapFromArray [
GVAR(BankMessenger) call ["sendAlert", [_uid, "error", _result select [7]]]; GVAR(BankMessenger) call ["sendAlert", [_uid, "error", _result select [7]]];
createHashMap createHashMap
}; };
if !(_result in ["true", "false"]) exitWith {
["ERROR", format ["Bank exists check for %1 returned unexpected response: %2", _uid, _result]] call EFUNC(common,log);
GVAR(BankMessenger) call ["sendAlert", [_uid, "error", "Bank backend returned an unexpected existence response."]];
createHashMap
};
private _finalAccount = createHashMap; private _finalAccount = createHashMap;
private _wasCreated = false; private _wasCreated = false;

View File

@ -26,7 +26,8 @@ params [["_function", "", [""]], ["_arguments", [], [[]]]];
private _quietFunctionLogs = [ private _quietFunctionLogs = [
"task:defuse:get", "task:defuse:get",
"task:catalog:get" "task:catalog:get",
"task:status:get"
]; ];
private _functionLower = toLower _function; private _functionLower = toLower _function;
if !(_functionLower in _quietFunctionLogs) then { if !(_functionLower in _quietFunctionLogs) then {

View File

@ -24,6 +24,7 @@ if (isNil QGVAR(AttackMissionGeneratorBaseClass)) then { call FUNC(attackMission
GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [ GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [
["#type", "MissionManagerBaseClass"], ["#type", "MissionManagerBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
_self set ["lastMissionGenerationAt", -1e10];
_self set ["recentLocationRegistry", []]; _self set ["recentLocationRegistry", []];
_self set ["activeMissionRegistry", createHashMap]; _self set ["activeMissionRegistry", createHashMap];
_self set ["generators", [createHashMapObject [GVAR(AttackMissionGeneratorBaseClass)]]]; _self set ["generators", [createHashMapObject [GVAR(AttackMissionGeneratorBaseClass)]]];
@ -155,6 +156,13 @@ if (GVAR(enableGenerator)) then {
GVAR(MissionManagerPFH) = [{ GVAR(MissionManagerPFH) = [{
GVAR(MissionManager) call ["cleanupCompletedMissions", []]; GVAR(MissionManager) call ["cleanupCompletedMissions", []];
private _now = diag_tickTime;
private _interval = GVAR(MissionManager) call ["getMissionInterval", []];
private _lastMissionGenerationAt = GVAR(MissionManager) getOrDefault ["lastMissionGenerationAt", -1e10];
if ((_now - _lastMissionGenerationAt) < _interval) exitWith {};
GVAR(MissionManager) set ["lastMissionGenerationAt", _now];
private _taskID = GVAR(MissionManager) call ["startAvailableMissions", []]; private _taskID = GVAR(MissionManager) call ["startAvailableMissions", []];
if (_taskID isEqualTo "") exitWith {}; if (_taskID isEqualTo "") exitWith {};

View File

@ -37,8 +37,8 @@
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(AttackTaskBaseClass) = createHashMapFromArray [ GVAR(AttackTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(AttackTaskBaseClass) merge [createHashMapFromArray [
["#type", "AttackTaskBaseClass"], ["#type", "AttackTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -224,4 +224,4 @@ GVAR(AttackTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(CargoEntityController) = createHashMapFromArray [ GVAR(CargoEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(CargoEntityController) merge [createHashMapFromArray [
["#type", "CargoEntityController"], ["#type", "CargoEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -77,4 +77,4 @@ GVAR(CargoEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(DefendTaskBaseClass) = createHashMapFromArray [ GVAR(DefendTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(DefendTaskBaseClass) merge [createHashMapFromArray [
["#type", "DefendTaskBaseClass"], ["#type", "DefendTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -213,4 +213,4 @@ GVAR(DefendTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(DefenseEnemyController) = createHashMapFromArray [ GVAR(DefenseEnemyController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(DefenseEnemyController) merge [createHashMapFromArray [
["#type", "DefenseEnemyController"], ["#type", "DefenseEnemyController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -49,4 +49,4 @@ GVAR(DefenseEnemyController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -37,8 +37,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(DefuseTaskBaseClass) = createHashMapFromArray [ GVAR(DefuseTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(DefuseTaskBaseClass) merge [createHashMapFromArray [
["#type", "DefuseTaskBaseClass"], ["#type", "DefuseTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -274,4 +274,4 @@ GVAR(DefuseTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(DeliveryTaskBaseClass) = createHashMapFromArray [ GVAR(DeliveryTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(DeliveryTaskBaseClass) merge [createHashMapFromArray [
["#type", "DeliveryTaskBaseClass"], ["#type", "DeliveryTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -201,4 +201,4 @@ GVAR(DeliveryTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(DestroyTaskBaseClass) = createHashMapFromArray [ GVAR(DestroyTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(DestroyTaskBaseClass) merge [createHashMapFromArray [
["#type", "DestroyTaskBaseClass"], ["#type", "DestroyTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -181,4 +181,4 @@ GVAR(DestroyTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(HVTEntityController) = createHashMapFromArray [ GVAR(HVTEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(HVTEntityController) merge [createHashMapFromArray [
["#type", "HVTEntityController"], ["#type", "HVTEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -69,4 +69,4 @@ GVAR(HVTEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(HVTTaskBaseClass) = createHashMapFromArray [ GVAR(HVTTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(HVTTaskBaseClass) merge [createHashMapFromArray [
["#type", "HVTTaskBaseClass"], ["#type", "HVTTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -237,4 +237,4 @@ GVAR(HVTTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -32,8 +32,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(HostageEntityController) = createHashMapFromArray [ GVAR(HostageEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(HostageEntityController) merge [createHashMapFromArray [
["#type", "HostageEntityController"], ["#type", "HostageEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -120,4 +120,4 @@ GVAR(HostageEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -40,8 +40,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(HostageTaskBaseClass) = createHashMapFromArray [ GVAR(HostageTaskBaseClass) = +GVAR(TaskInstanceBaseClass);
["#base", GVAR(TaskInstanceBaseClass)], GVAR(HostageTaskBaseClass) merge [createHashMapFromArray [
["#type", "HostageTaskBaseClass"], ["#type", "HostageTaskBaseClass"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -364,4 +364,4 @@ GVAR(HostageTaskBaseClass) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(IEDEntityController) = createHashMapFromArray [ GVAR(IEDEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(IEDEntityController) merge [createHashMapFromArray [
["#type", "IEDEntityController"], ["#type", "IEDEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -85,4 +85,4 @@ GVAR(IEDEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(ProtectedEntityController) = createHashMapFromArray [ GVAR(ProtectedEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(ProtectedEntityController) merge [createHashMapFromArray [
["#type", "ProtectedEntityController"], ["#type", "ProtectedEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -38,4 +38,4 @@ GVAR(ProtectedEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(ShooterEntityController) = createHashMapFromArray [ GVAR(ShooterEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(ShooterEntityController) merge [createHashMapFromArray [
["#type", "ShooterEntityController"], ["#type", "ShooterEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -38,4 +38,4 @@ GVAR(ShooterEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -5,8 +5,8 @@
*/ */
#pragma hemtt ignore_variables ["_self"] #pragma hemtt ignore_variables ["_self"]
GVAR(TargetEntityController) = createHashMapFromArray [ GVAR(TargetEntityController) = +GVAR(EntityControllerBaseClass);
["#base", GVAR(EntityControllerBaseClass)], GVAR(TargetEntityController) merge [createHashMapFromArray [
["#type", "TargetEntityController"], ["#type", "TargetEntityController"],
["#create", compileFinal { ["#create", compileFinal {
params [ params [
@ -38,4 +38,4 @@ GVAR(TargetEntityController) = createHashMapFromArray [
_self call ["cleanup", []]; _self call ["cleanup", []];
true true
}] }]
]; ], true];

View File

@ -548,6 +548,8 @@ pub fn update_bank(call_context: CallContext, key: String, json_update: String)
/// Checks if an bank exists in the database. /// Checks if an bank exists in the database.
/// ///
/// Returns "true" if the bank exists, "false" otherwise. /// Returns "true" if the bank exists, "false" otherwise.
/// Backend failures are returned as errors so callers do not confuse a failed
/// lookup with a missing account and create duplicate/default records.
pub fn bank_exists(call_context: CallContext, key: String) -> String { pub fn bank_exists(call_context: CallContext, key: String) -> String {
log( log(
"bank", "bank",
@ -561,12 +563,9 @@ pub fn bank_exists(call_context: CallContext, key: String) -> String {
uid uid
} }
None => { None => {
log( let error_msg = format!("Error: Failed to resolve UID for key: {}", key);
"bank", log("bank", "ERROR", &error_msg);
"WARN", return error_msg;
&format!("Failed to resolve UID for key: {}", key),
);
return "false".to_string();
} }
}; };
@ -580,12 +579,13 @@ pub fn bank_exists(call_context: CallContext, key: String) -> String {
exists.to_string() exists.to_string()
} }
Err(e) => { Err(e) => {
let error_msg = format!("Error: {}", e);
log( log(
"bank", "bank",
"ERROR", "ERROR",
&format!("Failed to check if bank '{}' exists: {}", resolved_uid, e), &format!("Failed to check if bank '{}' exists: {}", resolved_uid, e),
); );
"false".to_string() error_msg
} }
} }
} }