Skip to content

Commit

Permalink
fix(idle): Treat preCheck as async function
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Jan 15, 2025
1 parent 1d8e941 commit 346bb43
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/commands/idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function runIdle(connection) {
let doneSent = false;
let canEnd = false;

let preCheck = () => {
let preCheck = async () => {
doneRequested = true;
if (canEnd && !doneSent) {
connection.log.debug({
Expand Down Expand Up @@ -52,7 +52,7 @@ async function runIdle(connection) {
doneSent
});

preCheck();
connection.preCheck().catch(err => connection.log.warn({ err, cid: connection.id }));

return handler;
};
Expand All @@ -64,7 +64,7 @@ async function runIdle(connection) {
connection.log.debug({ msg: `Initiated IDLE, waiting for server input`, lockId: connection.currentLock?.lockId, doneRequested });
canEnd = true;
if (doneRequested) {
preCheck();
await connection.preCheck();
}
},
onSend: () => {
Expand Down

0 comments on commit 346bb43

Please sign in to comment.