Open mooseyboots opened 2 years ago
thanks for the pointer, i think i have something working with it.
(defmacro aio-with-timeout (timeout &rest body)
"Run body asynchronously.
If TIMEOUT seconds passes without completion, signal an
aio-timeout error."
(declare (indent 1))
`(let* ((promises (list (aio-with-async ,@body)
(aio-timeout ,timeout)))
(select (aio-make-select promises)))
(aio-with-async
(aio-await (aio-await (aio-select select))))))
it would be nice gracefully handle a timeout rather than just have the aio-timeout
error , which to me appears as Error running timer ‘funcall’: (aio-timeout . 0)
. but thats for another day for me.
i just gave this a library a go for a simple url-retrieve functionality.
i'm wondering how to set a timeout for it?
so far i just used code as in your example:
i see there's
aio-timeout
andaio-idle
but it's unclear to me how to use these to give up on such a request, if that's even what they can be used for? (since using aio in my code, sometimes a response comes in about 10 minutes late, longer after i have given up and re-run the command to fetch the url.