Skip to content

Commit 8c71f53

Browse files
authored
Merge pull request #91 from iantocristian/acknowledge-ping
feat: option to ping server in acknowledge
2 parents 169d6d1 + f18edaf commit 8c71f53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/logical-replication-service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,9 @@ export class LogicalReplicationService extends EventEmitter2 implements LogicalR
168168

169169
/**
170170
* @param lsn
171+
* @param ping Request server to respond
171172
*/
172-
public async acknowledge(lsn: string): Promise<boolean> {
173+
public async acknowledge(lsn: string, ping: boolean = false): Promise<boolean> {
173174
if (this._stop) return false;
174175
this.lastStandbyStatusUpdatedTime = Date.now();
175176

@@ -209,7 +210,7 @@ export class LogicalReplicationService extends EventEmitter2 implements LogicalR
209210
response.writeUInt32BE(lowerTimestamp, 29);
210211

211212
// If 1, requests server to respond immediately - can be used to verify connectivity
212-
response.writeInt8(0, 33);
213+
response.writeInt8(ping ? 1 : 0, 33);
213214

214215
// @ts-ignore
215216
this._connection?.sendCopyFromChunk(response);

0 commit comments

Comments
 (0)