Commit 969bd7df authored by Daiju Nakayama's avatar Daiju Nakayama

post_buyにtimerを仕込んだ

parent d391a2d1
#!/usr/bin/env python
import time
import datetime
import os
import pathlib
......@@ -729,6 +729,7 @@ def post_item_edit():
@app.route("/buy", methods=["POST"])
def post_buy():
t1 = time.time()
ensure_valid_csrf_token()
buyer = get_user()
......@@ -779,6 +780,8 @@ def post_buy():
target_item['id'],
))
t2 = time.time()
print('post_buy t1=%f', t2 - t1)g
host = get_shipment_service_url()
try:
res = requests.post(host + "/create",
......@@ -797,6 +800,8 @@ def post_buy():
shipping_res = res.json()
t3 = time.time()
print('post_buy t2=%f', t3 - t2)
host = get_payment_service_url()
try:
res = requests.post(host + "/token",
......@@ -812,6 +817,9 @@ def post_buy():
app.logger.exception(err)
http_json_error(requests.codes['internal_server_error'])
t4 = time.time()
print('post_buy t3=%f', t4 - t3)
payment_res = res.json()
if payment_res['status'] == "invalid":
conn.rollback()
......@@ -843,6 +851,8 @@ def post_buy():
except MySQLdb.Error as err:
app.logger.exception(err)
http_json_error(requests.codes['internal_server_error'], "db error")
t5 = time.time()
print('post_buy t4=%f', t5 - t4)
return flask.jsonify(dict(transaction_evidence_id=transaction_evidence_id))
......
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