fixed queue and finished initial qm work
This commit is contained in:
parent
52436c69b2
commit
00fbd31364
4 changed files with 45 additions and 56 deletions
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* QM Exchanges Operations - Simple exchange data fetching
|
||||
*/
|
||||
|
||||
import type { IServiceContainer } from '@stock-bot/handlers';
|
||||
|
||||
interface QMExchange {
|
||||
_id?: string;
|
||||
code: string;
|
||||
name: string;
|
||||
country: string;
|
||||
currency: string;
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
export async function fetchExchanges(services: IServiceContainer): Promise<QMExchange[]> {
|
||||
// Get exchanges from MongoDB
|
||||
const exchanges = await services.mongodb
|
||||
.collection<QMExchange>('qm_exchanges')
|
||||
.find({})
|
||||
.toArray();
|
||||
|
||||
return exchanges;
|
||||
}
|
||||
|
||||
export async function getExchangeByCode(
|
||||
services: IServiceContainer,
|
||||
code: string
|
||||
): Promise<QMExchange | null> {
|
||||
// Get specific exchange by code
|
||||
const exchange = await services.mongodb.collection<QMExchange>('qm_exchanges').findOne({ code });
|
||||
|
||||
return exchange;
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ export async function checkSessions(
|
|||
const neededSessions = SESSION_CONFIG.MAX_SESSIONS - currentCount;
|
||||
|
||||
// Queue up to 10 at a time to avoid overwhelming the system
|
||||
const toQueue = Math.min(neededSessions, 10);
|
||||
const toQueue = Math.min(neededSessions, 20);
|
||||
|
||||
for (let i = 0; i < toQueue; i++) {
|
||||
await this.scheduleOperation('create-session', { sessionId, sessionType }, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue