finished ceo
This commit is contained in:
parent
b25222778e
commit
a5688e4723
3 changed files with 11 additions and 7 deletions
|
|
@ -77,8 +77,8 @@
|
||||||
"port": 6379,
|
"port": 6379,
|
||||||
"db": 1
|
"db": 1
|
||||||
},
|
},
|
||||||
"workers": 1,
|
"workers": 5,
|
||||||
"concurrency": 1,
|
"concurrency": 3,
|
||||||
"enableScheduledJobs": true,
|
"enableScheduledJobs": true,
|
||||||
"defaultJobOptions": {
|
"defaultJobOptions": {
|
||||||
"attempts": 3,
|
"attempts": 3,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export async function getPosts(
|
||||||
payload: any,
|
payload: any,
|
||||||
_context: any
|
_context: any
|
||||||
): Promise<unknown> {
|
): Promise<unknown> {
|
||||||
const { ceoId, symbol, timestamp, untilTimestamp } = payload;
|
const { ceoId, symbol, timestamp, untilTimestamp, finished } = payload;
|
||||||
const proxy = this.proxy?.getProxy();
|
const proxy = this.proxy?.getProxy();
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
this.logger.warn('No proxy available for processing individual CEO symbol');
|
this.logger.warn('No proxy available for processing individual CEO symbol');
|
||||||
|
|
@ -41,9 +41,9 @@ export async function getPosts(
|
||||||
if (spielCount === 0) {
|
if (spielCount === 0) {
|
||||||
this.logger.warn(`No spiels found for ceoId ${ceoId}`);
|
this.logger.warn(`No spiels found for ceoId ${ceoId}`);
|
||||||
await this.mongodb.updateMany(
|
await this.mongodb.updateMany(
|
||||||
'ceoChannels',
|
'ceoSymbols',
|
||||||
{ ceoId },
|
{ ceoId },
|
||||||
{ $set: { lastSpielTime: timestamp, finished: true } }
|
{ $set: { lastSpielTime: timestamp || Date.now(), finished: true } }
|
||||||
);
|
);
|
||||||
return null; // No data to process
|
return null; // No data to process
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ export async function getPosts(
|
||||||
|
|
||||||
await this.mongodb.batchUpsert('ceoPosts', posts, ['spielId']);
|
await this.mongodb.batchUpsert('ceoPosts', posts, ['spielId']);
|
||||||
await this.mongodb.updateMany(
|
await this.mongodb.updateMany(
|
||||||
'ceoChannels',
|
'ceoSymbols',
|
||||||
{ ceoId },
|
{ ceoId },
|
||||||
{ $set: { lastSpielTime: latestSpielTime } }
|
{ $set: { lastSpielTime: latestSpielTime } }
|
||||||
);
|
);
|
||||||
|
|
@ -91,12 +91,14 @@ export async function getPosts(
|
||||||
|
|
||||||
// If untilTimestamp is not provider keep going to the end
|
// If untilTimestamp is not provider keep going to the end
|
||||||
// Otherwise keep going until the lastSpiel is before the untilTimestamp
|
// Otherwise keep going until the lastSpiel is before the untilTimestamp
|
||||||
if( untilTimestamp === undefined || (untilTimestamp && latestSpielTime <= untilTimestamp)) {
|
if( !finished || (finished && untilTimestamp && latestSpielTime > untilTimestamp)) {
|
||||||
await this.scheduleOperation(
|
await this.scheduleOperation(
|
||||||
'get-posts',
|
'get-posts',
|
||||||
{
|
{
|
||||||
ceoId: ceoId,
|
ceoId: ceoId,
|
||||||
timestamp: latestSpielTime,
|
timestamp: latestSpielTime,
|
||||||
|
finished: finished,
|
||||||
|
untilTimestamp: untilTimestamp,
|
||||||
},
|
},
|
||||||
{ priority: 0 }
|
{ priority: 0 }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ export async function updateUniqueSymbols(
|
||||||
{
|
{
|
||||||
ceoId: symbol.ceoId,
|
ceoId: symbol.ceoId,
|
||||||
symbol: symbol.symbol,
|
symbol: symbol.symbol,
|
||||||
|
finished: symbol.finished || false,
|
||||||
|
untilTimestamp: symbol.lastSpielTime || null,
|
||||||
},
|
},
|
||||||
{ priority: 10 }
|
{ priority: 10 }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue