-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
chain_return_value is only used in one place AgnosticGridOut.open: https://github.com/mongodb/motor/blob/35bdecfefee655b02e327063219d865165975156/motor/motor_gridfs.py#L164-L166
This is another example of complex code that could go away when we do MOTOR-583. Since MOTOR-583 can't be done until motor 3.0 we can do this instead:
@@ -148,6 +148,10 @@ class AgnosticGridOut(object): return getattr(self.delegate, item) + def _open(self): + self.delegate._ensure_file() + return self + @coroutine_annotation def open(self): """Retrieve this file's attributes from the server. @@ -161,9 +165,7 @@ class AgnosticGridOut(object): :class:`~motor.MotorGridOut` now opens itself on demand, calling ``open`` explicitly is rarely needed. """ - return self._framework.chain_return_value(self._ensure_file(), - self.get_io_loop(), - self) + return self._framework.run_on_executor(self.get_io_loop(), self._open)