inaka / cowboy-trails

A couple of improvements over Cowboy Routes

Home Page:http://inaka.github.io/cowboy-trails/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trails:do_store hangs for 60 seconds

tothlac opened this issue · comments

Executing this line takes sometimes a minute. The store function is called and soon after that remove is also called. It does not take always one minute but in a lot of cases I can see execution is stopped there. When I comment this line out everything works well.

Actually the list in the second parameter of do_store/2 can be huge. Is there a reason why application:ensure_all_started is called million times? Would not it be enough to start those applications only when trails starts?

{ok, _} = application:ensure_all_started(trails),

That line is there just as a convenience function so you don't need to manually ensure trails is started unless you use trails:store/1,2. I'm not sure why it shouldn't return instantly if trails is already started 🤔

In any case, as long as it passes all tests, I'm inclined to accept a PR removing that line

I've created a PR for this. Of course I had to change some lines in trails_SUITE because at some points it expects trails is not started before it calls trails:store. CT && dialyzer passes. Unfortunately cover was not 100% after the change, but it was also the same locally on your master. Do you expect cover to reach 100%?

That would be lovely, but since it wasn't 100% already… the best we can do is open a different ticket for that (#84).