Git Product home page Git Product logo

simple-background-tasks's Introduction

Background tasks with asyncio

It's simple and stateless. There is no cron schedule and no timeouts - just some coroutine being called over and over again. Your coroutine can run for 1ms or 1 year, it doesn't matter. It will run until it fails or succeeds, wait for a number of seconds, then start again. A use case could be to refresh a cache every so often based on a slow 3rd party service, or calculate some prometheus metrics that aren't strictly related to the API itself, whatever you want. I have tested it out in production and it seems surprisingly reliant.

The only thing you have to make sure of is that your coroutine is idempotent.

I wanted to create this because I wanted to build a FastAPI app that runs some task periodically in the background. I guess it can be used for anything though, as long as the app is asynchronous.

See the examples.

Backlog

  • Publish as python package on pypi

simple-background-tasks's People

Contributors

martimors avatar mamor1 avatar

Watchers

 avatar  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.