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.
This commit is contained in:
Joris Vink 2019-05-30 17:15:08 +02:00
parent a8aff8b737
commit ff7c85460c
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}