akka-http-session icon indicating copy to clipboard operation
akka-http-session copied to clipboard

RefreshTokenStorage schedule documentation

Open epifab opened this issue 8 years ago • 5 comments

Hello, I'm interested in using this project, but there are still some obscure undocumented aspects. The first one is the schedule method in the RefreshTokenStorage. Can you please clarify what is this for and how is it intended to be implemented? Also the after parameter should probably be a FiniteDuration rather than simply Duration, should it not? Is there a plan to work on some better documentation in general? Many thanks

epifab avatar Oct 16 '17 10:10 epifab

Hello,

the schedule method is used to schedule an action to be run in the background after the given amount of time. It is used to remove a used token after a (configurable) period of time. The token cannot be removed immediately as there might be multiple concurrent requests and this would cause some of them to fail (race condition).

You are right that after should probalby be a FiniteDuration. Maybe you can submit a PR fixing that?

As for docs, @kijanowski is working on a more docs/faq, see: https://github.com/softwaremill/akka-http-session-faq

adamw avatar Oct 17 '17 17:10 adamw

Hello!

Thanks for taking the time to answer. It's great that someone is working on the docs, I believe this is vital to get more people involved. Please note that the page you linked is currently 404ing for me.

I understand the reason behind the schedule method now. However, I'm wondering if that could be achieved in a different way, for example by requiring an implicit Scheduler. My point is that the schedule method is an implementation detail and should probably be transparent to the end user.

epifab avatar Oct 18 '17 14:10 epifab

Ah yes, just noticed it's a private temporary repository, we'll be publishing that soon :)

As for schedule... well I'm not very happy about it as well, but I didn't have a better idea at that time :). I suppose in all environments akka will be used anyway, so maybe it would be possible to provide a default implementation that uses the underlying http's actor system?

adamw avatar Oct 25 '17 11:10 adamw

Yeah, I believe so. I'm happy to work on a PR to improve this

epifab avatar Oct 27 '17 11:10 epifab

@epifab Sounds good, waiting for the code! :)

adamw avatar Oct 30 '17 09:10 adamw