python email sent is not in sequential order

93 views Asked by At

Scenario :
1 : if multiple user are logged in and clicked on "request" button
2 : A user has opened multiple tabs in browser for the same url and click "request" button

NOTE: autogrant check will be fetched from database if user has prviledge.

Problem Statement :
1: if request is autogrant then server sends first email with subject as user requested and then sends second email request approved

2: if request is autogrant not available then server sends only one email with subject as "user requested"

I don't know why but sometime in Problem Statement 1: user received the second email first. i.e. in reverse order. I'm not able to figure out what is causing the issue. it's happening in both the scenario

I'm using a turbogear for my website.
i have written instruction in sequential order in python :

s.sendmail("......")     # send email for subject user request
if autogrant(user):      # check for autogrant codition
    s.sendmail("......") # send email for request approved
0

There are 0 answers