Revert "Remove debug logs and improve query coalescing timeout (#2241)"

This reverts commit 71bee556f6.
This commit is contained in:
jelveh
2026-01-03 19:34:30 -08:00
parent 71bee556f6
commit 987effc5ec
3 changed files with 9 additions and 17 deletions
+2
View File
@@ -345,6 +345,7 @@ export default class PuterFSProvider {
} : {}),
};
console.log('raw fsentry', raw_fsentry);
const entryOp = await this.fsEntryController.insert(raw_fsentry);
await entryOp.awaitDone();
@@ -667,6 +668,7 @@ export default class PuterFSProvider {
* @returns {Promise<FSNode>}
*/
async write_new ({ context, parent, name, file }) {
console.log('calling write new');
const {
tmp, fsentry_tmp, message, actor: inputActor, app_id,
} = context.values;
+6 -17
View File
@@ -36,14 +36,7 @@ const tmp_provide_services = async ss => {
};
// TTL for pending get_app queries (request coalescing)
const PENDING_QUERY_TTL = 3; // seconds
const QUERY_TIMEOUT = 2000; // max ms to wait for a coalesced query
// Wait for a promise, but give up after timeout
const withTimeout = (promise, ms) => Promise.race([
promise,
new Promise((_, reject) => setTimeout(() => reject(new Error('Query timeout')), ms))
]);
const PENDING_QUERY_TTL = 2; // seconds
async function is_empty (dir_uuid) {
/** @type BaseDatabaseAccessService */
@@ -359,15 +352,11 @@ async function get_app (options) {
const pendingKey = `pending_app:${queryKey}`;
const pending = kv.get(pendingKey);
if ( pending ) {
// Wait for existing query, but don't block forever
try {
log.info(`coalescing query for ${queryKey}`);
const result = await withTimeout(pending, QUERY_TIMEOUT);
return result ? { ...result } : null;
} catch (err) {
// Timeout or error - fall through and execute query directly
log.warn(`coalesced query failed for ${queryKey}, executing direct query`);
}
// Reuse the existing pending query
log.info(`coalescing query for ${queryKey}`);
const result = await pending;
// shallow clone the result
return result ? { ...result } : null;
}
// Create a new pending query
@@ -110,6 +110,7 @@ class WebServerService extends BaseService {
const services = this.services;
await services.emit('start.webserver');
await services.emit('ready.webserver');
console.log('in case you care, ready.webserver hooks are done');
}
/**