Commit e63aad72 by Aeolus

Merge remote-tracking branch 'origin/master'

parents 4a9e4e7d e62fecde
......@@ -153,17 +153,6 @@ def wx_pay_callback():
machine = Machine.query.filter_by(machine_no=machine_no).first()
try:
lock_time = 0
while lock_time < 3:
# redis 加锁
lock_res = redis_client.set(RENT_SALE_LOCK + str(machine.id),
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), ex=60,
nx=True)
if lock_res:
break
lock_time += 1
time.sleep(1)
rent = Rent()
rent.rent_no = rent_no
rent.machine_no = machine.machine_no
......@@ -216,10 +205,8 @@ def wx_pay_callback():
db.session.commit()
except Exception as e:
redis_client.delete(RENT_SALE_LOCK + str(machine.id))
return xmltodict.unparse({'xml': error_data}, pretty=True), header
redis_client.delete(RENT_SALE_LOCK + str(machine.machine_id))
return xmltodict.unparse({'xml': response_data}, pretty=True), header
......
......@@ -13,4 +13,4 @@ app = create_app(os.getenv('RUN_ENV', 'prod'))
logger.info("run server")
if __name__ == '__main__':
app.run('127.0.0.1', 8893, debug=True)
app.run('127.0.0.1', 8893, debug=False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment