[openstack-dev] time.sleep is affected by eventlet.monkey_patch()

Yuriy Taraday yorik.sar at gmail.com
Fri Mar 7 07:52:56 UTC 2014


On Fri, Mar 7, 2014 at 11:20 AM, Yuriy Taraday <yorik.sar at gmail.com> wrote:

> All in all it sounds like an eventlet bug. I'm not sure how it can be
> dealt with though.
>

Digging into it I found out that eventlet uses time.time() by default that
is not monotonic. There's no clear way to replace it, but you can
workaround this:
1. Get monotonic clock function here:
http://stackoverflow.com/a/1205762/238308 (note that for FreeBSD or MacOS
you'll have to use different constant).
2. Make eventlet's hub use it:
eventlet.hubs._threadlocal.hub =
eventlet.hubs.get_default_hub().Hub(monotonic_time)

-- 

Kind regards, Yuriy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140307/d479964a/attachment.html>


More information about the OpenStack-dev mailing list