-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdks/actor/runtime): fix throttling code missing final call
- Loading branch information
1 parent
e4b2ce7
commit a729d28
Showing
2 changed files
with
93 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { assertUnreachable } from "../common/utils.ts"; | ||
|
||
export type WebSocketMessage = string | Blob | ArrayBuffer | Uint8Array; | ||
|
||
export function messageLength(message: WebSocketMessage): number { | ||
if (message instanceof Blob) { | ||
return message.size; | ||
} else if (message instanceof ArrayBuffer) { | ||
return message.byteLength; | ||
} else if (message instanceof Uint8Array) { | ||
return message.byteLength; | ||
} else if (typeof message === "string") { | ||
return message.length; | ||
} else { | ||
assertUnreachable(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters