web / lib/jobs/handlers/create-events-batch-job
lib/jobs/handlers/create-events-batch-job
Defines the job handler for creating events from a batch of imported data.
This job processes a specific batch of rows from an import file. For each row, it performs the following:
- Skips rows that have been identified as duplicates in the
analyze-duplicates-job. - Generates a unique ID for the event.
- Associates any available geocoding results with the event.
- Creates a new document in the
eventscollection.
The job updates the import job’s progress and handles errors for individual rows.
If more data is available in the file, it queues another CREATE_EVENTS_BATCH job for the next batch.
Once all batches are processed, it marks the import job as COMPLETED.
Variables
createEventsBatchJob
constcreateEventsBatchJob:object
Type declaration
slug
slug:
"create-events"=JOB_TYPES.CREATE_EVENTS
handler()
handler: (
context) =>Promise<{output: {completed:boolean;batchNumber?:undefined;eventsCreated?:undefined;eventsSkipped?:undefined;errors?:undefined;hasMore?:undefined; }; } | {output: {completed?:undefined;batchNumber:number;eventsCreated:number;eventsSkipped:number;errors:number;hasMore:boolean; }; }>
Parameters
context
Returns
Promise<{ output: { completed: boolean; batchNumber?: undefined; eventsCreated?: undefined; eventsSkipped?: undefined; errors?: undefined; hasMore?: undefined; }; } | { output: { completed?: undefined; batchNumber: number; eventsCreated: number; eventsSkipped: number; errors: number; hasMore: boolean; }; }>