qbo_auth: после invalid_grant статус сохраняется (не откатывается), sync отвечает 409 reauth_needed; найдено ручным тестом M1
Some checks failed
ci / test (push) Successful in 39s
ci / deploy (push) Has been cancelled

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 10:16:11 +03:00
parent 6d6b8aa22d
commit 065eee0bad
5 changed files with 40 additions and 14 deletions

View File

@@ -128,14 +128,20 @@ export class MemoryStore implements Store {
return this.conns.get(env) ?? null;
}
async withLock<T>(env: Env, fn: (c: LockedConn) => Promise<T>) {
return fn({
get: () => this.conns.get(env) ?? null,
save: async (c) => {
this.conns.set(env, c);
},
remove: async () => {
this.conns.delete(env);
},
});
const before = new Map(this.conns);
try {
return await fn({
get: () => this.conns.get(env) ?? null,
save: async (c) => {
this.conns.set(env, c);
},
remove: async () => {
this.conns.delete(env);
},
});
} catch (e) {
this.conns = before; // как транзакция PgStore: при исключении изменения откатываются
throw e;
}
}
}