fix(sync): start hourly operations after portfolio works finish (#201)
Backend verify / commits (pull_request) Successful in 1m42s
Backend verify / security (pull_request) Successful in 1m17s
Backend verify / verify (pull_request) Successful in 6m36s

This commit is contained in:
2026-11-11 09:14:34 +03:00
parent fee61537b6
commit 586e9fdd39
2 changed files with 31 additions and 1 deletions
@@ -244,16 +244,23 @@ export class TbankHourlyScheduler implements OnModuleDestroy, OnModuleInit {
dispatchProblems: HourlySection[],
walkStartedAt: Date,
) {
const portfolios: string[] = [];
for (const account of accounts) {
await this.dispatchPortfolio(
userId,
revision,
account.accountId,
dispatch,
async (child) => {
portfolios.push(child.id);
await dispatch(child);
},
dispatchProblems,
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) {
await this.dispatchOperations(
userId,