updated exchanges
This commit is contained in:
parent
0b33e9a8b6
commit
44fa3e8c0c
3 changed files with 17 additions and 9 deletions
|
|
@ -101,6 +101,11 @@ export class QMOperationTracker {
|
|||
}
|
||||
};
|
||||
|
||||
// Only update lastSuccessAt on successful operations
|
||||
if (data.status === 'success') {
|
||||
update.$set[`operations.${operationName}.lastSuccessAt`] = new Date();
|
||||
}
|
||||
|
||||
if (data.lastRecordDate) {
|
||||
update.$set[`operations.${operationName}.lastRecordDate`] = data.lastRecordDate;
|
||||
}
|
||||
|
|
@ -151,6 +156,11 @@ export class QMOperationTracker {
|
|||
}
|
||||
};
|
||||
|
||||
// Only update lastSuccessAt on successful operations
|
||||
if (data.status === 'success') {
|
||||
update.$set[`operations.${operation}.lastSuccessAt`] = new Date();
|
||||
}
|
||||
|
||||
if (data.lastRecordDate) {
|
||||
update.$set[`operations.${operation}.lastRecordDate`] = data.lastRecordDate;
|
||||
}
|
||||
|
|
@ -208,8 +218,8 @@ export class QMOperationTracker {
|
|||
|
||||
const filter: any = {
|
||||
$or: [
|
||||
{ [`operations.${operationName}.lastRunAt`]: { $lt: cutoffDate } },
|
||||
{ [`operations.${operationName}.lastRunAt`]: { $exists: false } },
|
||||
{ [`operations.${operationName}.lastSuccessAt`]: { $lt: cutoffDate } },
|
||||
{ [`operations.${operationName}.lastSuccessAt`]: { $exists: false } },
|
||||
{ [`operations.${operationName}`]: { $exists: false } }
|
||||
]
|
||||
};
|
||||
|
|
@ -221,7 +231,7 @@ export class QMOperationTracker {
|
|||
const symbols = await this.mongodb.find(this.collectionName, filter, {
|
||||
limit,
|
||||
projection: { qmSearchCode: 1 },
|
||||
sort: { [`operations.${operationName}.lastRunAt`]: 1 } // Oldest first
|
||||
sort: { [`operations.${operationName}.lastSuccessAt`]: 1 } // Oldest successful run first
|
||||
});
|
||||
|
||||
return symbols.map(s => s.qmSearchCode);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ export interface SymbolSpiderJob {
|
|||
|
||||
export interface Exchange {
|
||||
exchange: string;
|
||||
exchangeCode: string;
|
||||
exchangeShortName: string;
|
||||
exchangeName: string;
|
||||
countryCode: string;
|
||||
source: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue