dragonfly/addons/db/functions/fnc_addTask.sqf
Jacob Schmidt b23679a8c3 feat(debug): Enhance logging for task management and data handling
Added conditional logging for various functions in the DragonflyDB interface to improve debugging capabilities. This includes detailed logs for task processing, fetching, publishing, and subscribing actions, which are now only active in debug mode. Additionally, updated the buffer size and path handling in the main extension code for better performance and compatibility.
2025-03-23 22:32:18 -05:00

53 lines
2.1 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Function: dragonfly_db_fnc_addTask
* Author: Creedcoder, J.Schmidt
* Edit: 07.15.2024
* Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved
*
* Do not edit without permission!
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons,
* PO Box 1866, Mountain View, CA 94042
*
* [Description]
* Add task to queue.
*
* Arguments:
* 0: Type of task <STRING>
* 1: Name of stored key <STRING> (default: "")
* 2: Name of stored hash key field <STRING> (default: "")
* 3: Index of stored value in list <STRING> (default: -1)
* 4: Value to store in key [<ARRAY|STRING|NUMBER|BOOL>] (default: [])
* 5: Name of function to return data <STRING> (default: "")
* 6: Unscheduled environment <BOOL> (default: false)
* 7: NetID of target to return data from function <STRING> (default: "")
*
* Return Value:
* N/A
*
* Examples:
* ["hgetall", "", "", -1, [], "dragonfly_db_fnc_test", false] call dragonfly_db_fnc_addTask (Server or Singleplayer Only)
* ["hgetallid", getPlayerUID player, "", -1, [], "dragonfly_db_fnc_test", false, netId player] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false] (Multiplayer Only)
*
* Public: Yes
*/
params [["_taskType", "", [""]], ["_key", "", [""]], ["_keyField", "", [""]], ["_index", -1, [0]], ["_value", [], [[]]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]];
private _task = [_taskType, _key, _keyField, _index, _value, _function, _call, _netId];
#ifdef __ARMA__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Added Task '%1' to Queue", _task];
#endif
GVAR(taskQueue) pushBack _task;
#ifdef __ARMA__DEBUG__
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue: %1", GVAR(taskQueue)];
diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue Size: %1", count GVAR(taskQueue)];
#endif
if !(GVAR(isProcessing)) then { [] spawn FUNC(processQueue); };