Skip to content

Commit

Permalink
fix timing debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Dec 11, 2024
1 parent 275dfa7 commit a530e2d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/plugins/1password/src/cli-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,21 @@ async function checkOpCliAuth() {
// except for one further trick, which is to first check if we are already logged in, and resolve right away
opAuthDeferred = createDeferredPromise();
const startAt = new Date();
let isLoggedIn: boolean;
try {
await spawnAsync('op', ['whoami']);
opAuthDeferred.resolve(true);
isLoggedIn = true;
} catch (err) {
isLoggedIn = false;
}

const whoamiTime = +new Date() - +startAt;
debug(`additional whoami check took ${whoamiTime}ms`);

if (isLoggedIn) {
opAuthDeferred.resolve(true);
} else {
return opAuthDeferred.resolve;
} finally {
const whoamiTime = +new Date() - +startAt;
debug(`additional whoami check took ${whoamiTime}ms`);
}
}
}
Expand Down

0 comments on commit a530e2d

Please sign in to comment.