refactor: replace ignored numeric literals with constants
Backend security / security (push) Successful in 8s
Backend verify / verify (push) Failing after 2m17s
Conventional commits / commits (pull_request) Successful in 31s
Backend security / security (pull_request) Successful in 8s
Backend verify / verify (pull_request) Failing after 1m56s
Backend security / security (push) Successful in 8s
Backend verify / verify (push) Failing after 2m17s
Conventional commits / commits (pull_request) Successful in 31s
Backend security / security (pull_request) Successful in 8s
Backend verify / verify (pull_request) Failing after 1m56s
This commit is contained in:
@@ -11,6 +11,7 @@ import { accountHistory } from '../../investment-sync-plan';
|
||||
import {
|
||||
type OperationInterval,
|
||||
operationIntervals,
|
||||
operationsSyncPriority,
|
||||
planOperationRead,
|
||||
uncoveredOperationIntervals,
|
||||
} from '../domain/operations-sync-plan';
|
||||
@@ -19,8 +20,9 @@ import {
|
||||
type OperationAttempt,
|
||||
} from '../infrastructure/brokerage-operations.repository';
|
||||
|
||||
const UPSTREAM_RANGE_MARGIN_SECONDS = 1;
|
||||
|
||||
const operationsPageSize = 1000;
|
||||
const priorities = { screen: 1, history: 2 } as const;
|
||||
|
||||
@Injectable()
|
||||
export class BrokerageOperationsSyncService {
|
||||
@@ -129,7 +131,7 @@ export class BrokerageOperationsSyncService {
|
||||
userId: string,
|
||||
intervals: OperationInterval[],
|
||||
atomic: boolean,
|
||||
priority: keyof typeof priorities = 'screen',
|
||||
priority: keyof typeof operationsSyncPriority = 'screen',
|
||||
revision?: string,
|
||||
): Promise<null | string> {
|
||||
const connection = await this.access.local(userId);
|
||||
@@ -162,7 +164,7 @@ export class BrokerageOperationsSyncService {
|
||||
atomic,
|
||||
this.runningAttempts,
|
||||
// eslint-disable-next-line security/detect-object-injection -- The priority belongs to the internal priority union.
|
||||
priorities[priority],
|
||||
operationsSyncPriority[priority],
|
||||
);
|
||||
if (!requested) return null;
|
||||
const { id, attemptId, revision } = requested.work;
|
||||
@@ -257,12 +259,12 @@ export class BrokerageOperationsSyncService {
|
||||
// Upstream inclusivity is not assumed; storage selects exact [from,to).
|
||||
from: {
|
||||
seconds: String(
|
||||
Math.floor(interval.from.valueOf() / MILLISECONDS_PER_SECOND) - 1,
|
||||
Math.floor(interval.from.valueOf() / MILLISECONDS_PER_SECOND) - UPSTREAM_RANGE_MARGIN_SECONDS,
|
||||
),
|
||||
},
|
||||
to: {
|
||||
seconds: String(
|
||||
Math.ceil(interval.to.valueOf() / MILLISECONDS_PER_SECOND) + 1,
|
||||
Math.ceil(interval.to.valueOf() / MILLISECONDS_PER_SECOND) + UPSTREAM_RANGE_MARGIN_SECONDS,
|
||||
),
|
||||
},
|
||||
...(interval.instrumentUid ?
|
||||
|
||||
Reference in New Issue
Block a user