Git Product home page Git Product logo

Comments (7)

miguelgrinberg avatar miguelgrinberg commented on June 6, 2024

I cannot reproduce. I have added a test based on your code to this repository to confirm that background tasks are working fine. See 84562cf.

Maybe your background task is crashing for some reason and does not run to completion?

from flask-socketio.

al-awsdev4 avatar al-awsdev4 commented on June 6, 2024

@miguelgrinberg thank you for your quick response. It does not work even my background job contains just logger call:

@socketio.on('connect', namespace='/namespace')
  def handle_connect():
      def background_task():
          app.logger.info('Background task started')

      socketio.start_background_task(background_task)

Additional info:
platform linux -- Python 3.8.11, pytest-6.2.5

from flask-socketio.

miguelgrinberg avatar miguelgrinberg commented on June 6, 2024

You can confirm yourself that a similar test just added to this repository passes. I'm really not sure how I can help, given that I cannot debug an issue that I cannot reproduce. You can compare your testing procedures against mine in this repository to help you determine what is causing this.

from flask-socketio.

al-awsdev4 avatar al-awsdev4 commented on June 6, 2024

@miguelgrinberg got it. I'll try to compare and debug more deeply. I'll send feedback as soon as I find the reason.

from flask-socketio.

al-awsdev4 avatar al-awsdev4 commented on June 6, 2024

@miguelgrinberg, our application uses eventlet async mode, so that's one difference when issue is reproducible.

app = Flask(__name__)

socketio = SocketIO(
    logger=True,
    engineio_logger=True,
    async_mode='eventlet'
)

socketio.init_app(app=app)

I tried different versions of eventlet but it does not help.

from flask-socketio.

miguelgrinberg avatar miguelgrinberg commented on June 6, 2024

@al-awsdev4 If you are using eventlet during your test run you need to ensure that all the packages that you use to support your tests are compatible with eventlet style concurrency. Not sure which test runner you are using, but I have no idea if unittest, pytest, nose, etc. can be used safely with eventlet. Even if you were able to make your tests work fine in the past, supporting eventlet for unit tests has never been a goal.

from flask-socketio.

al-awsdev4 avatar al-awsdev4 commented on June 6, 2024

@miguelgrinberg, thank you for clarifying. Issue can be closed since it's not related to Socket.IO test client.

from flask-socketio.

Related Issues (20)

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.