Can I list 'active' routes?

60 views
Skip to first unread message

cimenta

unread,
Jan 2, 2012, 11:09:09 PM1/2/12
to sinatrarb
Hi

is there any way to 'list all active' routes. I mean routes that are
being processed/served?

I want to make sure that a route could be processed only once at a
time. Is there any way to do so? I use only simple sinatra rb file.

sinatra (1.3.2)
sinatra-advanced-routes (0.5.1)
sinatra-reloader (0.5.0)
sinatra-sugar (0.5.1)

Thank you

Radek

Jason Rogers

unread,
Jan 3, 2012, 2:28:00 AM1/3/12
to sina...@googlegroups.com
You could "enable: sessions" and then set a session variable:

get '/my_route_which_allows_no_concurrency/?' do
raise 'this route does not support concurrency' if
session[:processing_special_route]
session[:processing_special_route] = true
# ...
session[:processing_special_route] = false
# return your result
end

--
Jason Rogers

> --
> You received this message because you are subscribed to the Google Groups "sinatrarb" group.
> To post to this group, send email to sina...@googlegroups.com.
> To unsubscribe from this group, send email to sinatrarb+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sinatrarb?hl=en.
>

Konstantin Haase

unread,
Jan 3, 2012, 4:12:12 AM1/3/12
to sina...@googlegroups.com
Please, upgrade those extensions.

We don't have per-route locking at the moment, though it wouldn't be to hard to build. You can do per-request locking with `enable :lock`.

Konstantin

Reply all
Reply to author
Forward
0 new messages