style: trim narration comments from recent changes
This commit is contained in:
@@ -19,17 +19,13 @@ class PocketBaseAdminClient {
|
||||
this.pb = new PocketBase(process.env.POCKETBASE_URL);
|
||||
|
||||
this.pb.beforeSend = async (url, options) => {
|
||||
// The auth requests themselves must skip the gate below: gating them on
|
||||
// authPromise would make them await their own completion (deadlock).
|
||||
// Auth requests skip the gate: awaiting authPromise here would deadlock them.
|
||||
if (!url.includes("/collections/_superusers/auth-")) {
|
||||
try {
|
||||
await this.authPromise;
|
||||
} catch {
|
||||
// Swallow: fall through to self-heal so a rejected authPromise can't strand every request.
|
||||
}
|
||||
} catch {}
|
||||
|
||||
if (!this.pb.authStore.isValid) {
|
||||
// Self-heal: re-auth once PocketBase is reachable again, no restart.
|
||||
this.authPromise = this.authenticate();
|
||||
await this.authPromise;
|
||||
this.startTokenRefresh();
|
||||
@@ -43,8 +39,6 @@ class PocketBaseAdminClient {
|
||||
}
|
||||
}
|
||||
|
||||
// The SDK stamps Authorization before this hook runs, so a request
|
||||
// built while auth was still in flight carries no (or a stale) token.
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
Authorization: this.pb.authStore.token,
|
||||
@@ -75,8 +69,6 @@ class PocketBaseAdminClient {
|
||||
Object.assign(this, createPushService(this.pb));
|
||||
|
||||
this.authPromise = this.authenticate();
|
||||
// Fail soft at boot: an unreachable PocketBase must not crash the process;
|
||||
// beforeSend self-heals on the next request.
|
||||
this.authPromise
|
||||
.then(() => {
|
||||
this.startTokenRefresh();
|
||||
|
||||
Reference in New Issue
Block a user