dragonfly/addons/db/functions/fnc_pubSubFetch.sqf
Jacob Schmidt ce904a7978
All checks were successful
Build / Build (push) Successful in 30s
feat(db): Add debug logging to all DragonflyDB functions
Enhanced debugging capabilities by adding conditional logging statements to all DragonflyDB functions. These logs include input parameters and return values, providing detailed insights into function execution. The logging is enabled only when the `__A3__DEBUG__` preprocessor directive is defined, ensuring minimal performance impact in production environments. This change improves the ability to diagnose issues and understand the flow of data within the DragonflyDB system.
2025-03-23 23:20:03 -05:00

58 lines
1.9 KiB
Plaintext

#include "..\script_component.hpp"
/*
@file Title: ArmaDragonflyClient Framework by Creedcoder, J.Schmidt
@file Version: 0.1
@file Name: fnc_pubSubFetch.sqf
@file Author: Creedcoder, J.Schmidt
@file edit: 03.25.2024
Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved
Do not edit without permission!
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlikes 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons,
444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Fetch from DB:
dragonfly_db_pubSubFetch_array
["uniqueID", "evetnType", "eventName", "index", "indextotal", "datachunk", "target"]
*/
#ifdef __A3__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data: %1", _this];
#endif
params ["_uniqueID", "_eventType", "_eventName", "_index", "_total", "_datachunk", "_target"];
private _dataString = "";
private _index_array = [];
private _count_total = -1;
dragonfly_db_pubSubFetch_array pushBackUnique [_uniqueID, _eventType, _eventName, _index, _total, _datachunk, _target];
_count_total = {
if (_uniqueID == _x select 0) then {
_index_array pushBackUnique [_x select 3, _x select 5];
true
} else {
false
}
} count dragonfly_db_pubSubFetch_array;
if (_count_total == _total) then {
_index_array sort true;
for "_i" from 0 to (_total - 1) do {
_dataString = _dataString + ((_index_array select _i) select 1);
};
#ifdef __ARMA_DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data String: %1", _dataString];
#endif
[_uniqueID, _eventType, _eventName, (parseSimpleArray _dataString), _target] call FUNC(pubSubHandler);
dragonfly_db_pubSubFetch_array = dragonfly_db_pubSubFetch_array select {!((_x select 0) in [_uniqueID])};
};