refactor!: simplify runtime coordination #7
Keep financial ownership, atomic publication and refresh CAS. Failed refresh leaves cookies untouched; logout still clears them. Remove full-history candle prefetch and special metadata retries. Use native Pino request context instead of parallel middleware. BREAKING CHANGE: remove investment stateVersion, queued sync state, and tbank-sync status progress/resources. Consumers must observe resources through sync=observe with the updated frontend contract.
This commit is contained in:
@@ -44,15 +44,9 @@ export class ForecastRepository {
|
||||
data: { membershipRevision: { increment: 0 } },
|
||||
});
|
||||
if (!current.count) return null;
|
||||
}
|
||||
const connection = await tx.tbankConnection.findFirst({
|
||||
where: {
|
||||
...owner,
|
||||
membershipRevision: input.membershipRevision,
|
||||
invalidToken: false,
|
||||
},
|
||||
});
|
||||
if (!connection) return null;
|
||||
} else if (!(await tx.tbankConnection.findFirst({
|
||||
where: { ...owner, membershipRevision: input.membershipRevision, invalidToken: false },
|
||||
}))) return null;
|
||||
const key = { ...owner, scopeKey: input.scopeKey };
|
||||
const previous = await tx.tbankForecast.findUnique({
|
||||
where: { userId_revision_scopeKey: key },
|
||||
|
||||
@@ -52,7 +52,7 @@ export class PortfolioRepository {
|
||||
revision: string,
|
||||
accountId: string,
|
||||
processRunId: string,
|
||||
active: ReadonlySet<string>,
|
||||
pending: ReadonlyMap<string, Promise<void>>,
|
||||
force: boolean,
|
||||
) {
|
||||
return this.prisma.$transaction(async (tx) => {
|
||||
@@ -83,7 +83,7 @@ export class PortfolioRepository {
|
||||
if (
|
||||
previous?.state === 'running' &&
|
||||
previous.processRunId === processRunId &&
|
||||
active.has(previous.attemptId)
|
||||
pending.has(previous.attemptId)
|
||||
) {
|
||||
return { work: previous, launch: false };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user