Code Monkey home page Code Monkey logo

Comments (5)

WilliamBergamin avatar WilliamBergamin commented on June 3, 2024

Hi @PrajwalNaik07 thank fro writing in

You should be able to accomplish this by starting multiple python processes that execute your application source code
For example run python app.py in 2 separate terminals each process will open a WebSocket connections.

from bolt-python.

PrajwalNaik07 avatar PrajwalNaik07 commented on June 3, 2024

Hi @WilliamBergamin ,

I tried the above approach, and it significantly reduces my issues, but in one instance saw that a particular event was triggered in one of the replica pods but the socket mode got reconnected in between the process execution resulting in failure of the process, could you tell me how to avoid this even thought I am running multiple pods for my app

from bolt-python.

seratch avatar seratch commented on June 3, 2024

As long as you keep at least one connection alive all the time, terminating others does not matter. Slack's API server delivers to any of the active connections and does retries for Events API messages. If you terminate all the instances at a time, indeed the situation your app may miss some events may arise.

from bolt-python.

PrajwalNaik07 avatar PrajwalNaik07 commented on June 3, 2024

Hi @seratch ,

So we are running two pods for the app socket mode, and they are handling all the requests but in my case I have added a button in the app and when the user clicks the button I start a particular function. I have logged when the process starts, and when checked the pods it seems like the process started but before completion of the process the socket mode got reconnected loosing to complete the function, so according the socket mode the request was received but before completion the socket mode got re-established resulting in failure of process and giving the fallback output. How do I handle this

from bolt-python.

seratch avatar seratch commented on June 3, 2024

I appreciate your clarification on the matter.

Indeed, with Socket Mode, there could be a risk of the event handling failure like you described. Unfortunately, there's no perfect solution to completely avoid this potential issue with Socket Mode. The connection can be re-establihed upon a request from Slack server or due to a network error.

If clicking the button again isn't acceptable for your app's operational need, an alternative approach would be to run your Slack app instances behind a publicly accesible "Request URL" instead, plus to implement a graceful shutdown process for running bolt-python instances. This will help prevent the loss of any events being processed.

I understand this could be frustrating for your need, but I hope this was helpful to you.

from bolt-python.

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.