softwaremill / akka-http-session

Web & mobile client-side akka-http sessions, with optional JWT support

Home Page:https://softwaremill.com/open-source/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RefreshTokenStorage schedule documentation

epifab opened this issue · 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

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

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.

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?

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

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