New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/backend-tasks

Package Overview
Dependencies
Maintainers
4
Versions
984
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/backend-tasks

Common distributed task management library for Backstage backends

  • 0.0.0-nightly-20220831030347
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
59K
decreased by-1.56%
Maintainers
4
Weekly downloads
 
Created
Source

@backstage/backend-tasks

Common distributed task management for Backstage backends.

Usage

Add the library to your backend package:

# From your Backstage root directory
yarn add --cwd packages/backend @backstage/backend-tasks

then make use of its facilities as necessary:

import { TaskScheduler } from '@backstage/backend-tasks';

const scheduler = TaskScheduler.fromConfig(rootConfig).forPlugin('my-plugin');

await scheduler.scheduleTask({
  id: 'refresh_things',
  frequency: { cron: '*/5 * * * *' }, // every 5 minutes, also supports Duration
  timeout: { minutes: 15 },
  fn: async () => {
    await entityProvider.run();
  },
});

Local Development

When working with the @backstage/backend-tasks library you may run into your task not running immediately at startup as expected if you are using a persistent database. This is by design - the library respects the previous state and does not run the task sooner than the specified frequency. If you want to get around this, there is a table called backstage_backend_tasks__tasks in the applicable plugin's database which will contain a record with the next run date and time. You can delete this record to get things back to what you expect.

Documentation

  • Backstage Readme
  • Backstage Documentation

Keywords

FAQs

Package last updated on 31 Aug 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc