Author SHA1 Message Date
ksv741 4a17f1fffd fix(performance): ignore non-RUB cash flows (WealthLedger/main#55)
Backend verify / commits (pull_request) Failing after 1m39s
Backend verify / security (pull_request) Skipped
Backend verify / verify (pull_request) Skipped
2026-11-11 09:00:25 +03:00
ksv741 b4c83e7462 fix: rebuild RUB-only snapshots on next tick (WealthLedger/main#55) 2026-11-11 08:51:34 +03:00
ksv741 3b55b611b5 refactor!: support RUB only (WealthLedger/main#55)
Filter non-RUB data at ingest, collapse per-currency collections into single RUB Money, drop currency from TbankPortfolioValuePoint, remove NON_RUB_ACTIVITY and screener currency filter.

BREAKING CHANGE: per-currency API fields replaced with single RUB Money; stock screener currency param removed.
2026-11-11 08:22:16 +03:00
2 changed files with 1 additions and 31 deletions
@@ -244,23 +244,16 @@ export class TbankHourlyScheduler implements OnModuleDestroy, OnModuleInit {
dispatchProblems: HourlySection[], dispatchProblems: HourlySection[],
walkStartedAt: Date, walkStartedAt: Date,
) { ) {
const portfolios: string[] = [];
for (const account of accounts) { for (const account of accounts) {
await this.dispatchPortfolio( await this.dispatchPortfolio(
userId, userId,
revision, revision,
account.accountId, account.accountId,
async (child) => { dispatch,
portfolios.push(child.id);
await dispatch(child);
},
dispatchProblems, dispatchProblems,
walkStartedAt, walkStartedAt,
); );
} }
// Operations coverage must end after the Portfolio valuation it explains:
// performance requires coverage up to the snapshot fetchedAt.
await this.waitWorks(userId, portfolios);
for (const account of accounts) { for (const account of accounts) {
await this.dispatchOperations( await this.dispatchOperations(
userId, userId,
-23
View File
@@ -167,29 +167,6 @@ describe('hourly attempt lifecycle (SQLite)', () => {
expect(read?.state).toBe('succeeded'); expect(read?.state).toBe('succeeded');
}); });
it('starts operations only after every portfolio work finished', async () => {
const portfolios: string[] = [];
portfolio.request.mockImplementation(
async (_userId: string, _revision: string, accountId: string) => {
const row = await child('running', null, `portfolio:${accountId}`);
portfolios.push(row.id);
return { id: row.id, done: Promise.resolve() };
},
);
const scheduler = createScheduler();
await scheduler.tick();
await pump();
expect(portfolios).toHaveLength(2);
expect(operations.request).not.toHaveBeenCalled();
await prisma.tbankSyncWork.updateMany({
where: { id: { in: portfolios } },
data: { state: 'complete' },
});
const row = await runWalk(scheduler);
expect(operations.request).toHaveBeenCalledTimes(2);
expect(row.state).toBe('complete');
});
it('settles partial and keeps successful steps when one account fails', async () => { it('settles partial and keeps successful steps when one account fails', async () => {
portfolio.request.mockImplementation( portfolio.request.mockImplementation(
async (_userId: string, _revision: string, accountId: string) => { async (_userId: string, _revision: string, accountId: string) => {