core: Minor cleanup.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 10m46s

This commit is contained in:
2025-12-07 08:25:55 -05:00
parent 14955fa421
commit 2086075f7b
3 changed files with 15 additions and 26 deletions

View File

@@ -13,8 +13,6 @@ let gStatsTimer = false;
let g_handler_index = 0; let g_handler_index = 0;
/** Whether updating accounts information is currently scheduled. */ /** Whether updating accounts information is currently scheduled. */
let g_update_accounts_scheduled; let g_update_accounts_scheduled;
/** Time between pings, in milliseconds. */
const k_ping_interval = 60 * 1000;
/** /**
** App constructor. ** App constructor.
@@ -219,7 +217,7 @@ function postMessageInternal(from, to, message) {
* @param options Other options. * @param options Other options.
* @return The process. * @return The process.
*/ */
async function getProcessBlob(blobId, key, options) { exports.getProcessBlob = async function getProcessBlob(blobId, key, options) {
let process = gProcesses[key]; let process = gProcesses[key];
if (!process && !(options && 'create' in options && !options.create)) { if (!process && !(options && 'create' in options && !options.create)) {
let resolveReady; let resolveReady;
@@ -239,7 +237,6 @@ async function getProcessBlob(blobId, key, options) {
} }
process.lastActive = Date.now(); process.lastActive = Date.now();
process.lastPing = null; process.lastPing = null;
process.timeout = k_ping_interval;
process.ready = new Promise(function (resolve, reject) { process.ready = new Promise(function (resolve, reject) {
resolveReady = resolve; resolveReady = resolve;
rejectReady = reject; rejectReady = reject;
@@ -692,16 +689,7 @@ async function getProcessBlob(blobId, key, options) {
} }
} }
return process; return process;
} };
/**
* Get or create a process for an app blob.
* @param blobId The blob identifier.
* @param key A unique key for the invocation.
* @param options Other options.
* @return The process.
*/
exports.getProcessBlob = getProcessBlob;
/** /**
* Send any changed account information. * Send any changed account information.

View File

@@ -237,16 +237,19 @@ static void _httpd_auth_query_work(tf_ssb_t* ssb, void* user_data)
static void _httpd_app_kill_task(app_t* work) static void _httpd_app_kill_task(app_t* work)
{ {
JSContext* context = work->request->context; JSContext* context = work->request->context;
if (!JS_IsUndefined(work->process)) if (JS_IsObject(work->process))
{ {
JSValue task = JS_GetPropertyStr(context, work->process, "task"); JSValue task = JS_GetPropertyStr(context, work->process, "task");
if (!JS_IsUndefined(task)) if (JS_IsObject(task))
{ {
JSValue kill = JS_GetPropertyStr(context, task, "kill"); JSValue kill = JS_GetPropertyStr(context, task, "kill");
JSValue result = JS_Call(context, kill, task, 0, NULL); if (!JS_IsUndefined(kill))
tf_util_report_error(context, result); {
JS_FreeValue(context, result); JSValue result = JS_Call(context, kill, task, 0, NULL);
JS_FreeValue(context, kill); tf_util_report_error(context, result);
JS_FreeValue(context, result);
JS_FreeValue(context, kill);
}
} }
JS_FreeValue(context, task); JS_FreeValue(context, task);
} }

View File

@@ -227,14 +227,12 @@ bool tf_util_report_error(JSContext* context, JSValue value)
tf_printf("ERROR: %s\n", string); tf_printf("ERROR: %s\n", string);
JS_FreeCString(context, string); JS_FreeCString(context, string);
JSValue stack = JS_GetPropertyStr(context, value, "stack"); const char* stack = tf_util_get_property_as_string(context, value, "stack");
if (!JS_IsUndefined(stack)) if (stack && *stack)
{ {
const char* stack_str = JS_ToCString(context, stack); tf_printf("%s\n", stack);
tf_printf("%s\n", stack_str);
JS_FreeCString(context, stack_str);
} }
JS_FreeValue(context, stack); JS_FreeCString(context, stack);
tf_task_send_error_to_parent(task, value); tf_task_send_error_to_parent(task, value);
is_error = true; is_error = true;