MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / createCachedTask

Function createCachedTask

js/botasaurus-server-js/src/routes-db-logic.ts:441–461  ·  view source on GitHub ↗
(task_data: any, cacheKey: any, sort_id: number)

Source from the content-addressed store, hash-verified

439 const cachedTasks: any[] = [];
440
441 const createCachedTask = async (task_data: any, cacheKey: any, sort_id: number) => {
442 const now_time = new Date()
443 const {count:cachedResultCount, isLarge} = await TaskResults.getCachedItemDetails(cacheKey)
444 return new Task({
445 id: getAutoincrementId(),
446 status: TaskStatus.COMPLETED,
447 sort_id,
448 task_name: get_task_name ? get_task_name(task_data) : null,
449 scraper_name,
450 scraper_type,
451 is_all_task: false,
452 priority,
453 is_large:isLarge,
454 parent_task_id: all_task_id,
455 started_at: now_time,
456 finished_at: now_time,
457 data: task_data,
458 meta_data: metadata,
459 result_count: cachedResultCount,
460 })
461 };
462
463 for (let i = 0; i < ls.length; i++) {
464 const item = ls[i];

Callers 1

createCachedTasksFunction · 0.85

Calls 2

getAutoincrementIdFunction · 0.90
getCachedItemDetailsMethod · 0.80

Tested by

no test coverage detected