fixed up delay time
This commit is contained in:
parent
d9404c2bda
commit
58c5ba1200
4 changed files with 61 additions and 47 deletions
|
|
@ -12,22 +12,30 @@ export const testRoutes = new Hono();
|
|||
// Test endpoint for new functional batch processing
|
||||
testRoutes.post('/api/test/batch-symbols', async (c) => {
|
||||
try {
|
||||
const { symbols, useBatching = false, totalDelayMs = 60000 } = await c.req.json();
|
||||
const { processSymbols } = await import('../utils/batch-helpers');
|
||||
const { symbols, useBatching = false, totalDelayHours = 1 } = await c.req.json();
|
||||
const { processItems } = await import('../utils/batch-helpers');
|
||||
|
||||
if (!symbols || !Array.isArray(symbols)) {
|
||||
return c.json({ status: 'error', message: 'symbols array is required' }, 400);
|
||||
}
|
||||
|
||||
const result = await processSymbols(symbols, queueManager, {
|
||||
operation: 'live-data',
|
||||
service: 'test',
|
||||
provider: 'test-provider',
|
||||
totalDelayMs,
|
||||
useBatching,
|
||||
batchSize: 10,
|
||||
priority: 1
|
||||
});
|
||||
const result = await processItems(
|
||||
symbols,
|
||||
(symbol, index) => ({
|
||||
symbol,
|
||||
index,
|
||||
timestamp: new Date().toISOString()
|
||||
}),
|
||||
queueManager,
|
||||
{
|
||||
totalDelayHours,
|
||||
useBatching,
|
||||
batchSize: 10,
|
||||
priority: 1,
|
||||
provider: 'test-provider',
|
||||
operation: 'live-data'
|
||||
}
|
||||
);
|
||||
|
||||
return c.json({
|
||||
status: 'success',
|
||||
|
|
@ -42,7 +50,7 @@ testRoutes.post('/api/test/batch-symbols', async (c) => {
|
|||
|
||||
testRoutes.post('/api/test/batch-custom', async (c) => {
|
||||
try {
|
||||
const { items, useBatching = false, totalDelayMs = 30000 } = await c.req.json();
|
||||
const { items, useBatching = false, totalDelayHours = 0.5 } = await c.req.json();
|
||||
const { processItems } = await import('../utils/batch-helpers');
|
||||
|
||||
if (!items || !Array.isArray(items)) {
|
||||
|
|
@ -58,10 +66,12 @@ testRoutes.post('/api/test/batch-custom', async (c) => {
|
|||
}),
|
||||
queueManager,
|
||||
{
|
||||
totalDelayMs,
|
||||
totalDelayHours,
|
||||
useBatching,
|
||||
batchSize: 5,
|
||||
priority: 1
|
||||
priority: 1,
|
||||
provider: 'test-provider',
|
||||
operation: 'custom-test'
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue