Skip to content

Commit 2dfa43a

Browse files
authored
fix: ensure payload size check respects PostgreSQL NOTIFY limit (#17)
The previous check used `>` instead of `>=` with a default threshold of 8000 bytes. Since PostgreSQL's `NOTIFY` command has a strict limit of 7999 bytes, a payload of exactly 8000 bytes would bypass the attachment logic and cause the query to fail.
1 parent a9300c1 commit 2dfa43a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class PubSubClient {
170170
}
171171

172172
const payload = JSON.stringify(message);
173-
if (Buffer.byteLength(payload) > this.opts.payloadThreshold) {
173+
if (Buffer.byteLength(payload) >= this.opts.payloadThreshold) {
174174
return this.publishWithAttachment(message);
175175
}
176176

0 commit comments

Comments
 (0)