-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(system-test): fix isolates use of hono #2124
fix(system-test): fix isolates use of hono #2124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR refactors the system test implementation to properly integrate Hono's WebSocket functionality across both Deno and Node.js environments, with unified WebSocket handling and improved type safety.
- Modified
/examples/misc/system-test/src/isolate/main.ts
to use Deno's WebSocket upgrader with proper KV API validation - Updated
/examples/misc/system-test/src/shared/server.ts
to support both Deno and Node.js environments with unified WebSocket handling - Reduced resource allocation in
/examples/misc/system-test/tests/client.ts
from 250/256 to 100 CPU/memory units for containers - Added Deno types in
/examples/misc/system-test/tsconfig.json
for proper type checking across runtimes - Changed build script path in
/examples/misc/system-test/rivet.jsonc
to point to correct entry pointsrc/isolate/main.ts
8 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
"@types/deno": "^2.2.0", | ||
"@types/node": "^22.13.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Using both @types/deno and @types/node could cause type conflicts since they may define overlapping globals differently
import { createNodeWebSocket } from "@hono/node-ws"; | ||
import { serve } from "@hono/node-server"; | ||
|
||
let injectWebSocket: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: avoid using 'any' type - should define proper type for injectWebSocket from @hono/node-ws
() => upgradeWebSocket, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: upgradeWebSocket should be passed directly, not wrapped in an arrow function
() => upgradeWebSocket, | |
); | |
upgradeWebSocket, | |
); |
// Setup auto-exit timer | ||
setTimeout(() => { | ||
console.error( | ||
"Actor should've been destroyed by now. Automatically exiting.", | ||
); | ||
exitFn(); | ||
() => process.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: The process.exit(1) call is wrapped in an arrow function that is never executed
() => process.exit(1) | |
process.exit(1) |
|
||
// Add WebSocket endpoint with handler | ||
let upgradeWebSocket = getUpgradeWebSocket(app); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: let is used but the variable is never reassigned - should be const
3424da5
to
ec9a121
Compare
ec9a121
to
a4a8905
Compare
2dc32f4
to
a5ffea8
Compare
a4a8905
to
bc461e7
Compare
a5ffea8
to
2537e7e
Compare
Merge activity
|
<!-- Please make sure there is an issue that this PR is correlated to. --> ## Changes <!-- If there are frontend changes, please include screenshots. -->
Changes