GithubHelp home page GithubHelp logo

starlette-background-cancelled's Introduction

starlette-bg-cancelled

This repository is here to reproduce a bug observed in the usage of background tasks in Starlette.

Requirements

Install uvicorn, gunicorn and starlette

pip install uvicorn gunicorn starlette

Launch the server

Launch the server either with uvicorn, on a TCP or Unix socket:

uvicorn bg_tasks:application --port 8000
uvicorn bg_tasks:application --uds server.sock

Or with gunicorn

gunicorn -k uvicorn.workers.UvicornWorker bg_tasks:application --bind 127.0.0.1:8000
gunicorn -k uvicorn.workers.UvicornWorker bg_tasks:application --bind unix:server.sock

Launch the HTTP client scripts

The HTTP client scripts will target port 8000 (default for both uvicorn and gunicorn).

To call the /single route - connection is closed after response is received:

python http_call.py single --tcp 127.0.0.1:8000
python http_call.py single --uds server.sock

To call the /multiple route - connection is closed after response is received:

python http_call.py multiple --tcp 127.0.0.1:8000
python http_call.py multiple --uds server.sock

To call the /wait route and close connection without waiting for the response:

python http_call.py wait --tcp 127.0.0.1:8000 --action close_nowait
python http_call.py wait --uds server.sock --action close_nowait

starlette-background-cancelled's People

Contributors

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