2

Lets say I have the following code:

limit = 2
current = 0

app.route('/increase')
def add_to_current():
    if current >= limit:
        raise Exception("limit reached")
    current+=1
    return str(current)

Then I access this endpoint a bunch of times at the same time. Will a ToCToU or a race condition occur? Or does flask handle this for me?

If flask doesn't handle this, what is the best way to do so without rewriting the function?

JohnSkandi
  • 34
  • 4

0 Answers0