Socket
Socket
Sign inDemoInstall

@eggjs/tegg-schedule-decorator

Package Overview
Dependencies
54
Maintainers
12
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @eggjs/tegg-schedule-decorator

tegg schedule decorator


Version published
Weekly downloads
252
decreased by-72.58%
Maintainers
12
Created
Weekly downloads
 

Readme

Source

@eggjs/tegg-schedule-decorator

Install

npm i --save @eggjs/tegg-schedule-decorator

Define schedule subscriber

import { Schedule } from '@eggjs/tegg';

// use number to define schedule interval
@Schedule<IntervalParams>({
  type: ScheduleType.WORKER,
  scheduleData: {
    // run every 100ms
    interval: 100,
  },
})
export class FooSubscriber {
  @Inject()
  private readonly logger: EggLogger;

  async subscribe() {
    this.logger.info('schedule called');
  }
}

// use cron to define schedule interval
@Schedule<CronParams>({
  type: ScheduleType.WORKER,
  scheduleData: {
    cron: '0 0 3 * * *',
  },
})
export class FooSubscriber {
  @Inject()
  private readonly logger: EggLogger;

  async subscribe() {
    this.logger.info('schedule called');
  }
}

Keywords

FAQs

Last updated on 19 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc