57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
/**
|
|
* Scheduler configuration
|
|
*
|
|
* This file defines all scheduled tasks for the application.
|
|
* The scheduler runs in a separate process using: node ace scheduler:work
|
|
*
|
|
* Learn more: https://github.com/kabbouchi/adonisjs-scheduler
|
|
*/
|
|
|
|
import scheduler from 'adonisjs-scheduler/services/main'
|
|
import ParseAuctions from '../commands/parse_auctions.js'
|
|
|
|
/**
|
|
* Schedule auction parsing every 6 hours
|
|
*
|
|
* This task will:
|
|
* 1. Scrape auctions from icetrade.by
|
|
* 2. Upsert them to the database
|
|
* 3. Create notifications for keyword matches
|
|
*
|
|
* Configuration:
|
|
* - Runs every 6 hours
|
|
* - Prevents overlapping executions
|
|
* - Scrapes 1 page by default (can be adjusted)
|
|
*/
|
|
scheduler
|
|
.command(ParseAuctions, ['--pages=1'])
|
|
.everySixHours()
|
|
.withoutOverlapping()
|
|
|
|
/**
|
|
* Alternative schedule options (uncomment to use):
|
|
*
|
|
* Run every hour:
|
|
*/
|
|
// scheduler.command(ParseAuctions).everyHour().withoutOverlapping()
|
|
|
|
/**
|
|
* Run every 3 hours using cron:
|
|
*/
|
|
// scheduler.command(ParseAuctions).cron('0 *\/3 * * *').withoutOverlapping()
|
|
|
|
/**
|
|
* Run at specific times (6am, 12pm, 6pm, 12am):
|
|
*/
|
|
// scheduler.command(ParseAuctions).cron('0 6,12,18,0 * * *').withoutOverlapping()
|
|
|
|
/**
|
|
* Run every 30 minutes:
|
|
*/
|
|
// scheduler.command(ParseAuctions).everyThirtyMinutes().withoutOverlapping()
|
|
|
|
/**
|
|
* Run daily at 3am:
|
|
*/
|
|
// scheduler.command(ParseAuctions).dailyAt('3:00').withoutOverlapping()
|