Skip to content

Commit 8fb04d5

Browse files
committed
update comments
Signed-off-by: Nik Nasr <nik@restate.dev>
1 parent e9ec7a9 commit 8fb04d5

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/libs/restate-sdk/src/endpoint/handlers/fetch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ export function fetcher(handler: RestateHandler) {
4848
abortSignal: event.signal,
4949
})
5050
.catch((e) => {
51-
// Framework wrapper guarantees writeHead is called and closes the
52-
// output stream; anything reaching here is a post-commit error.
51+
// wrapResponseWithSafety guarantees writeHead is called and
52+
// closes the output stream; anything reaching here is a
53+
// post-commit error.
5354
const error = ensureError(e);
5455
const logger =
5556
tryCreateContextualLogger(

packages/libs/restate-sdk/src/endpoint/handlers/generic.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export function createRestateHandler(
9595
}
9696

9797
/**
98-
* Framework-level safety net around a user-provided `RestateResponse`.
98+
* Safety net around a `RestateResponse` returned by `_handle()`, applied
99+
* in `RestateHandlerImpl.handle()` before the response reaches any adapter.
99100
*
100101
* Guarantees to adapters:
101102
* - `writeHead` is called exactly once on the success path.

packages/libs/restate-sdk/src/endpoint/handlers/lambda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ export class LambdaHandler {
155155
};
156156
}
157157

158-
// Framework wrapper guarantees writeHead was called, so this resolves
159-
// synchronously on the next microtask.
158+
// wrapResponseWithSafety guarantees writeHead was called, so this
159+
// resolves synchronously on the next microtask.
160160
const head = await headPromise;
161161

162162
const responseBodyBuffer = Buffer.concat(chunks);

packages/libs/restate-sdk/src/endpoint/node_endpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function nodeHandlerImpl(
209209
abortSignal: abortController.signal,
210210
})
211211
.catch((e) => {
212-
// Framework wrapper guarantees writeHead is called; anything
212+
// wrapResponseWithSafety guarantees writeHead is called; anything
213213
// reaching here is a post-commit error. Nothing to do but log.
214214
const error = ensureError(e);
215215
const logger =

0 commit comments

Comments
 (0)