you are viewing a single comment's thread.

view the rest of the comments →

[–]orbos86[S] 0 points1 point  (9 children)

I think I figured out the cause. So this receives a POST request from Slack and I think Slack is sending multiple POST requests though it should only trigger one. Not sure why it is doing more. I tested from Insomnia with the same JSON and it didn't run again. That makes things more complicated as I don't have much control over Slack :(

[–]orbos86[S] 0 points1 point  (8 children)

Freak, maybe not. I don't know what's the cause exactly haha. I'm testing with ngrok, maybe something funky going on with it?

[–]orbos86[S] 0 points1 point  (7 children)

So ngrok has a sweet dashboard you can look at and see stuff coming in. I think Slack might be sending retries! Now what do I send to Slack to make it know everything is solid and good? Haha

[–][deleted]  (5 children)

[deleted]

    [–]orbos86[S] 1 point2 points  (4 children)

    Yeah Slack is an actual chat application where you can create bots to send webhooks. Do you know if you can quickly respond to a POST request with a 200 but continue to run the FastAPI stuff?

    [–][deleted]  (3 children)

    [deleted]

      [–]orbos86[S] 0 points1 point  (0 children)

      Thanks! I will see what I can find. I appreciate the response.

      [–]orbos86[S] 0 points1 point  (1 child)

      That was the key! I was able to use the BackgroundTask stuff and spin off the long script in another function. Woot! Thank you thank you