mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
release the GIL during a DB request
This commit is contained in:
parent
90de4a267d
commit
daaf8bdc70
1 changed files with 6 additions and 5 deletions
|
@ -76,11 +76,12 @@ impl Backend {
|
|||
|
||||
fn db_command(&mut self, py: Python, input: &PyBytes) -> PyResult<PyObject> {
|
||||
let in_bytes = input.as_bytes();
|
||||
let out_string = self
|
||||
.backend
|
||||
.db_command(in_bytes)
|
||||
.map_err(|e| DBError::py_err(e.localized_description(&self.backend.i18n())))?;
|
||||
|
||||
let out_res = py.allow_threads(move || {
|
||||
self.backend
|
||||
.db_command(in_bytes)
|
||||
.map_err(|e| DBError::py_err(e.localized_description(&self.backend.i18n())))
|
||||
});
|
||||
let out_string = out_res?;
|
||||
let out_obj = PyBytes::new(py, out_string.as_bytes());
|
||||
Ok(out_obj.into())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue