commit ff7c85460c7272e8ddba2643d6aa751677ac2440
parent a8aff8b73793cff09f1e7f26253d6c9290cd2eec
Author: Joris Vink <joris@coders.se>
Date: Thu, 30 May 2019 17:15:08 +0200
Wake up HTTP requests if python coros finish immediately.
python_coro_create() puts the HTTP request to sleep, but if they
finish immediately they will be removed from the list and should
properly be woken up or they are removed from the wrong list.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/python.c b/src/python.c
@@ -669,11 +669,11 @@ python_runtime_http_request(void *addr, struct http_request *req)
if (PyCoro_CheckExact(pyret)) {
req->py_coro = python_coro_create(pyret, req);
if (python_coro_run(req->py_coro) == KORE_RESULT_OK) {
+ http_request_wakeup(req);
kore_python_coro_delete(req->py_coro);
req->py_coro = NULL;
return (KORE_RESULT_OK);
}
- http_request_sleep(req);
return (KORE_RESULT_RETRY);
}
@@ -744,12 +744,12 @@ python_runtime_validator(void *addr, struct http_request *req, const void *data)
coro = python_coro_create(pyret, req);
req->py_coro = coro;
if (python_coro_run(coro) == KORE_RESULT_OK) {
+ http_request_wakeup(req);
ret = python_validator_check(coro->result);
kore_python_coro_delete(coro);
req->py_coro = NULL;
return (ret);
}
- http_request_sleep(req);
return (KORE_RESULT_RETRY);
}