Giter Site home page Giter Site logo

background's Introduction

background

A tiny library to make it easier to run multiple top-level goroutines in the same application:

  • runner provides an abstraction that handles shutdown signal and wait group (so that goroutines don't need to care about it)
  • job represents logic that is run inside top-level goroutine. There are 2 jobs that I use most often and therefore provided by default:
    • recurring job
      • run work periodically (using Go ticker)
      • an example can be found here. This example spins up 2 goroutines that run ticker periodically. 2nd job has some custom clean up logic
    • blocking job
      • run work and block waiting for it to complete (.e.g. a http server)
      • an example can be found here. This example runs a recurring job in 1 goroutine and a http server in the other. The http server has custom clean up logic
    • when a work implements CleanUp interface from job, both recurring and blocking jobs above will execute clean up logic when they receive shutdown signal

background's People

Contributors

hpcsc avatar

Watchers

 avatar

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.