@giselles-ai/browser-tool 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/relay/index.js +24 -1
- package/package.json +1 -1
package/dist/relay/index.js
CHANGED
|
@@ -426,6 +426,14 @@ async function dispatchRelayRequest(input) {
|
|
|
426
426
|
const storedResponseKey = responseKey(input.sessionId, requestId);
|
|
427
427
|
const responseEventChannel = relayResponseChannel(input.sessionId, requestId);
|
|
428
428
|
const subscriber = createRelaySubscriber();
|
|
429
|
+
const dispatchedAt = Date.now();
|
|
430
|
+
console.log(
|
|
431
|
+
"[relay] dispatchRelayRequest: requestId=%s, sessionId=%s, type=%s, ttl=%ds",
|
|
432
|
+
requestId,
|
|
433
|
+
input.sessionId,
|
|
434
|
+
input.request.type,
|
|
435
|
+
DEFAULT_REQUEST_TTL_SEC
|
|
436
|
+
);
|
|
429
437
|
const setPending = await redis.set(
|
|
430
438
|
requestTypeStateKey,
|
|
431
439
|
input.request.type,
|
|
@@ -453,6 +461,12 @@ async function dispatchRelayRequest(input) {
|
|
|
453
461
|
);
|
|
454
462
|
}
|
|
455
463
|
});
|
|
464
|
+
const elapsedMs = Date.now() - dispatchedAt;
|
|
465
|
+
console.log(
|
|
466
|
+
"[relay] dispatchRelayRequest resolved: requestId=%s, elapsed=%dms",
|
|
467
|
+
requestId,
|
|
468
|
+
elapsedMs
|
|
469
|
+
);
|
|
456
470
|
const storedResponse = await redis.get(storedResponseKey);
|
|
457
471
|
if (!storedResponse) {
|
|
458
472
|
throw createRelayError(
|
|
@@ -482,7 +496,16 @@ async function resolveRelayResponse(input) {
|
|
|
482
496
|
const redis = getRedisClient();
|
|
483
497
|
const requestId = input.response.requestId;
|
|
484
498
|
const requestTypeStateKey = requestTypeKey(input.sessionId, requestId);
|
|
485
|
-
const expectedRequestTypeRaw = await
|
|
499
|
+
const [expectedRequestTypeRaw, remainingTtl] = await Promise.all([
|
|
500
|
+
redis.get(requestTypeStateKey),
|
|
501
|
+
redis.ttl(requestTypeStateKey)
|
|
502
|
+
]);
|
|
503
|
+
console.log(
|
|
504
|
+
"[relay] resolveRelayResponse: requestId=%s, found=%s, remainingTtl=%ds",
|
|
505
|
+
requestId,
|
|
506
|
+
!!expectedRequestTypeRaw,
|
|
507
|
+
remainingTtl
|
|
508
|
+
);
|
|
486
509
|
if (!expectedRequestTypeRaw) {
|
|
487
510
|
throw createRelayError(
|
|
488
511
|
"NOT_FOUND",
|