-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimeoutException #15
Comments
I ended up modifying my code - I thought I had to catch exception on the get/set function as opposed to when future is processed. I ended up using Either method to gracefully handle failure in my calling code.
|
@colinbes yes, Btw, a def liftTry[T](source: Future[T])(implicit ec: ExecutionContext): Future[Try[T]] = {
val p = Promise[Try[T]]()
source.onComplete { case result => p.success(result) }
p.future
} And in fact, because Shade currently depends on monifu-core (for the time being, though I'm thinking of removing it in the next version), you can just use this helper as it is defined in Monifu, like so: import monifu.concurrent.extensions._
// now this works ...
val result: Future[Try[Option[T]]] =
memcached.get[T](key).liftTry |
@colinbes also make sure to update to the latest version of Shade, I released 1.7.1 yesterday. |
Thanks @alexandru for the good input and the update! |
I am wondering how to ensure graceful handling of timeout exception when get or set of memcache when memcache is not actually running.
I must be doing something wrong in trying to capture the exception and would appreciate any advice.
I am assuming I need to wrap the memcache.get with a try/catch block.
The text was updated successfully, but these errors were encountered: