Skip to content

Commit

Permalink
Remove db lock
Browse files Browse the repository at this point in the history
  • Loading branch information
nnayk committed Dec 8, 2023
1 parent ddef8e5 commit 5443ca9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Backend/db_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@
load_dotenv()

app = Flask(__name__)
db_lock = 0
# db_lock = 0


@app.before_request
def db_connect(DB_URL=None):
if not db_lock:
# MongoDB connection
mongo_uri = DB_URL or os.environ.get("MONGO_URI")
connect(alias="default", host=mongo_uri)
db_lock = 1
return True
# MongoDB connection
mongo_uri = DB_URL or os.environ.get("MONGO_URI")
connect(alias="default", host=mongo_uri)
return True


class Response:
Expand Down

0 comments on commit 5443ca9

Please sign in to comment.