Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ return Ok({ result: 42 });
return Err({ code: 'INVALID_INPUT', message: 'Value must be positive' });
```

#### Graceful server drain

`server.drain({ budgetMs })` refuses new calls with `SERVER_DRAINING` before handlers run. It waits for in-flight RPCs and uploads up to `budgetMs`, then closes the transport.

```ts
const client = createClient<ServiceSurface>(transport, 'SERVER', {
resendRefusedCalls: { maxResends: 3, newSessionWaitMs: 30_000 },
});
```

Resend is off by default. It only resends RPCs refused with `SERVER_DRAINING` on a new session, bounded by `maxResends` and `newSessionWaitMs`. `ReaderErrorSchema` gains a code. Exhaustive TypeScript error switches need a new case.

Comment thread
Armster15 marked this conversation as resolved.
#### Custom Error Types

You can define custom error schemas for your procedures:
Expand Down
Loading
Loading