retry for re-authentication

10 views
Skip to first unread message

Devon Miller

unread,
Oct 18, 2014, 9:50:16 AM10/18/14
to dispatc...@googlegroups.com
I am using dispatch for a small REST driver to a database system.

The database system has a REST interface that issues session ids that expire after X minutes.

My driver issues http requests fine and the REST calls work.

But I would like to transparently add automatic retry to each request after the session expires.

I would like to have this inside the driver so that the programmer does not need to explicitly add retries's to their code.

How would I do this with dispatch's retry?

Nathan Hamblen

unread,
Oct 18, 2014, 7:19:34 PM10/18/14
to dispatc...@googlegroups.com
dispatch.retry is for requests that fail unpredictably, so I don't think
it's the right fit for what you're talking about. Instead of attempting
a request that will fail, I would track the expiration time in the db
driver interface and fetch a new session when the current time is within
some threshold of the expiration. Since this likely requires two
requests, you would flatMap the two futures.

Nathan
> --
> You received this message because you are subscribed to the Google
> Groups "Dispatch" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to dispatch-scal...@googlegroups.com
> <mailto:dispatch-scal...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Devon Miller

unread,
Oct 18, 2014, 10:13:01 PM10/18/14
to dispatc...@googlegroups.com
That does sound like a simpler way to do it. I'll give it a shot.
Reply all
Reply to author
Forward
0 new messages