Giter Site home page Giter Site logo

node-workers-example's Introduction

Background Jobs in Node.js with Redis

Redis-backed background worker example using OptimalBits/bull and throng.

Application Screenshot

Deploy

Installing Local Dependencies

$ brew install redis
$ brew services start redis

Getting Started

  1. npm install
  2. npm start
  3. http://localhost:5000

Deploying

$ git clone [email protected]:heroku-examples/node-workers-example.git
$ cd node-workers-example

$ heroku create
$ heroku addons:create heroku-redis
$ git push heroku main
$ heroku ps:scale worker=1
$ heroku open

Application Overview

The application is comprised of two process:

  • web - An Express server that serves the frontend assets, accepts new background jobs, and reports on the status us existing jobs
  • worker - A small node process that listens for and executes incoming jobs

Because these are separate processes, they can be scaled independently based on specific application needs. Read the Process Model article for a more in-depth understanding of Heroku’s process model.

The web process serves the index.html and client.js files which implement a simplified example of a frontend interface that kicks off new jobs and checks in on them.

node-workers-example's People

Contributors

aprilsnows avatar danielleadams avatar dependabot[bot] avatar jmorrell avatar k4m4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-workers-example's Issues

Problem with background jobs on heroku

Hello guys. I'm trying to run this same example on heroku, but it's not working. It looks like heroku works differently for working with background jobs and they provide an example with nodejs https://devcenter.heroku.com/articles/node-redis-workers and https://github.com/heroku-examples/ node-workers-example, but I can't transport this to nestjs and also using redis. Does anyone please have a solution or an example I can use? I scoured the web and found nothing. In the end, the application ends up giving this error "maxRetriesPerRequestError: Reached the max retries per request limit (which is 20). Refer to "maxRetriesPerRequest" option for details"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.